// sock is a fd from socket() buffer is a char* area allready made and size is the max bytes to put in there int recvline(unsigned int sock,char* buffer,unsigned int size) { char buffer2[size]; unsigned int bytesread; bytesread=recv(sock,buffer,size-2,MSG_PEEK); buffer[bytesread]='\0'; if (bytesread==0){size=0;return -2;} #ifdef recvlinedebug printf("%d bytes of text '%s' read in peek mode searching for \\r \\n or \\0\n",bytesread,buffer); #endif for(unsigned int x=0;x