I am brand new to using sockets in the winapi, but I have this code and I am trying to print all data coming from a socket, but when I try printing it it comes out as a jumbled mix of symbols what am I doing wrong. I have looked around for examples on how to do this but none of the examples show how to print the data after it is collected from the buffer.
do
{
#define DEFAULT_BUFLEN 512
int recvbuflen = DEFAULT_BUFLEN;
char recvbuf[DEFAULT_BUFLEN];
recv(ConnectSocket, recvbuf, recvbuflen, 0);
printf("%.*s", recvbuflen, recvbuf);
}
while (iResult > 0);
ok guys i have changed my code to this
do
{
#define DEFAULT_BUFLEN 1000000
int recvbuflen = DEFAULT_BUFLEN;
char recvbuf[DEFAULT_BUFLEN];
ssize_t len = recv(ConnectSocket, recvbuf, recvbuflen, 0);
recv(ConnectSocket, recvbuf, recvbuflen, 0);
printf("%.*s", recvbuflen, recvbuf);
}
while (iResult > 0);
but now it doesnt seem to print all information from socket just first part