TCP Server-Client : Echo string from client

September 4th, 2008  |  by  |  published in Linux Sample Programs

// Author : Amit Sahrawat // Client Program #include <stdio.h> #include <sys/socket.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <netinet/in.h> #define BUFFSIZE 256 #define SERVER_PORT 6401 int main(int argc, char** argv) { int sock; struct sockaddr_in echoserver; char buffer[BUFFSIZE]={0}; unsigned int echolen; int received =0; if(argc<3) { printf(“Usage : cli <serverip> <String> \n”); exit(1); } […]

Subscribe

Get articles in your inbox.

Enter your email address:

Join Us

Twitter Chatter


Recommendations

Archives

Categories