/* Use standard echo server; baseline measurements for nonblocking version */ #include "unp.h" int main(int argc, char **argv) { int sockfd; struct sockaddr_in servaddr; if (argc != 2) err_quit("usage: tcpcli "); sockfd = Socket(AF_INET, SOCK_STREAM, 0); bzero(&servaddr, sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_port = htons(7); Inet_pton(AF_INET, argv[1], &servaddr.sin_addr); Connect_timeo(sockfd, (SA *) &servaddr, sizeof(servaddr), 10); str_cli(stdin, sockfd); /* do it all */ exit(0); }