C program to implemet TCP Server #include <stdio.h> #include <sys/socket.h> #include <sys/types.h> #include <arpa/inet.h> #include <string.h> int main(void) { int s, len; char buf[BUFSIZ]; struct sockaddr_in remote_addr; memset(&remote_addr, 0, sizeof(remote_addr)); remote_addr.sin_family = AF_INET; remote_addr.sin_addr.s_addr = inet_addr(“127.0.0.1″); remote_addr.sin_port = htons(8000); if( (s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { printf(“Error\n”); return -1; } if( connect(s, (struct sockaddr*)&remote_addr, sizeof(struct sockaddr)) < 0 ) { printf(“Error\n”); ...
In this site you may learn about new Triks in Computer. Follow me on my YouTube Channel https://www.youtube.com/DailyBytesPrayagraj