#include #include #include #include #include #include int main() { int sockdesc; struct sockaddr_in servaddr; sockdesc=socket(AF_INET,SOCK_STREAM,0); if(sockdesc==-1) { printf("Socket not created"); return -1; } servaddr.sin_family=AF_INET; servaddr.sin_port=htons(1025); servaddr.sin_addr.s_addr=htonl(INADDR_ANY); if (connect(sockdesc,(struct sockaddr*)&servaddr,sizeof(servaddr)) < 0) { printf("Connect Failed"); return -1; } char buffer[10]; fgets(buffer,sizeof(buffer),stdin); write(sockdesc,buffer,sizeof(buffer)); read(sockdesc,buffer,10); printf("Message from server: %s", buffer); close(sockdesc); return 0; }