I am writing a small c socket program. However a call to recv() indicates that 32 bytes of data was received, however calling fprintf as below displays a blank line to the console. What beats me is that data actually returns but printing blank lines. Is it possible I am using the wrong format specifier for fprintf?
messagesize = recv(socketHandle, recvbuffer, sizeof(recvbuffer), 0);
fprintf(stdout, "%d bytes read <<< ping message \n", messagesize);
recvbuffer[messagesize] = '\0';
fprintf(stdout, "message received : %s\n\n", (char *) recvbuffer);
Comments
Post a Comment