#include #include #include #include #include #define port 8081 int main() { int sockfd; struct sockaddr_in client; if((sockfd=socket(AF_INET,SOCK_STREAM,0))<0) perror("socket failed\n"); client.sin_family = AF_INET; client.sin_addr.s_addr = inet_addr("127.0.0.1"); client.sin_port = htons(port); if(connect(sockfd,(struct sockaddr*)&client,sizeof(client))<0) perror("connection failed\n"); else printf("connected successfully\n"); while(1) { char s[20]; printf("enter the data to send\n"); scanf("%s",s); send(sockfd,(char*)s,strlen(s),0); } }