X-Git-Url: https://gapil.gnulinux.it/gitweb/?a=blobdiff_plain;f=listati%2FTCP_echo_fifth.c;fp=listati%2FTCP_echo_fifth.c;h=2f219027ec5cf9871cd02c2a95e3d6906d3a837c;hb=8654ce33b450ae7bb34c3907835000a0760c2931;hp=0000000000000000000000000000000000000000;hpb=88d8a251947f948094d35de596feaf49e975f91b;p=gapil.git diff --git a/listati/TCP_echo_fifth.c b/listati/TCP_echo_fifth.c new file mode 100644 index 0000000..2f21902 --- /dev/null +++ b/listati/TCP_echo_fifth.c @@ -0,0 +1,18 @@ +int main(int argc, char *argv[]) +{ +/* + * Variables definition + */ + int sock, i; + int reset = 0; + ... + /* call sockaddr to get a connected socket */ + if ( (sock = sockconn(argv[optind], "echo", 6, SOCK_STREAM)) < 0) { + if (errno) perror("Socket creation error"); + return 1; + } + /* do read/write operations */ + ClientEcho(stdin, sock); + /* normal exit */ + return 0; +}