DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T f

⟦e3936bc6c⟧ TextFile

    Length: 732 (0x2dc)
    Types: TextFile
    Names: »findserv.c«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/euug-87hel/sec8/inet/findserv.c« 

TextFile

#include <stdio.h>

#include "service.h"

#define TIMEOUT 10

#define SIGN_ON	    "sign on."
#define NUM_MSGS 5

int sock_to_serv;
char in_buf[BUFSIZ];

main( argc, argv)
int argc;
char *argv[];
{
    int i;
    char *msg = "They're here!";

    if ( argc > 1 ) msg = argv[1];

    if ( (sock_to_serv =
	  obtain_service( SERV_NAME, SERV_PORT, TIMEOUT,
			  SIGN_ON, sizeof(SIGN_ON) )) < 0 ) {
	fprintf( stderr, "Service request timed out\n" );
	exit(1);
    }
    printf( "Client side started\n" );

    for ( i = 0; i < NUM_MSGS; ++i ) {
	datagram_string( sock_to_serv, msg );
	sleep(5);
    }

    close(sock_to_serv);
}

int
datagram_string( sock, string )
int sock;
char *string;
{
    write( sock, string, strlen(string) );
}