#include "common.h" int main(int argc, char **argv) { int client_sock, port; char *host, buf[MAXLINE]; rio_t rio; if (argc != 3) { fprintf(stderr, "usage: %s \n", argv[0]); exit(1); } host = argv[1]; port = atoi(argv[2]); client_sock = open_client_sock(host, port); if(client_sock==-1) { fputs("Error to connect the Server\n",stdout); exit(1); } while (fgets(buf, MAXLINE, stdin) != NULL) { //sleep(1); send(client_sock, buf, strlen(buf),0); recv(client_sock, buf, MAXLINE,0); fputs(buf, stdout); } close(client_sock); exit(0); }