Os dejo el codigo del servidor a ver si encontrais algo raro.
Código
#include <netinet/in.h> #include <sys/socket.h> #include <sys/types.h> #include <iostream> using namespace std; int main(){ int sockfd, new_sock,numbytes,sin_size; char text[1024]; struct sockaddr_in servidor={AF_INET,htons(1234),INADDR_ANY}; struct sockaddr_in cliente; sockfd=socket(AF_INET,SOCK_STREAM,0); bind(sockfd,(struct sockaddr *)&servidor,sizeof(struct sockaddr)); listen(sockfd,5); while(1){ sin_size=sizeof(struct sockaddr_in); if((new_sock=accept(sockfd,(struct sockaddr *)&cliente,(socklen_t*)&sin_size))==-1){ cout<<"Error de conexion"<<endl; return -1; } numbytes=recv(new_sock,text,1024,0); text[numbytes]='\0'; cout<<text<<endl; close(new_sock); } }