# Include <stdarg. h>
# Include <stdio. h>
# Include <netdb. h>
# Include <sys/socket. h>
# Include <netinet/in. h>
# Include <errno. h>
# Include <sys/select. h>
# Include <math. h>
Void process_client (INT s ){
Char buff [128];
Int RC, maxfd;
While (fgets (buff, sizeof (buff), stdin )! = NULL ){
Write (S, buff, strlen (buff ));
Rc = read (S, buff, sizeof (buff ));
If (RC <= 0)
Error (1, 0, "No data !! /N ");
Buff [RC] = '/0 ';
Write (1, buff, RC );
Bzero (buff, sizeof (buff ));
}
}
Int main (INT argc, char ** argv ){
Struct sockaddr_in server, temp;
Char * hname, * sname;
Int S, C, Len;
If (argc <2)
Error (1, 0, "parameters less than 2/N ");
Else if (argc = 2 ){
Hname = NULL;
Sname = argv [1];
}
Else if (argc = 3 ){
Hname = argv [1];
Sname = argv [2];
}
S = client_connect (hname, sname, & server, "UDP", 1 );
Printf ("% s, % d", inet_ntoa (server. sin_addr), ntohs (server. sin_port ));
Process_client (s );
Close (s );
Exit (0 );
}