Originally Posted by eXistenZ
Ok so it looks like you are using async sockets... since well you are using the CasyncSocket class here. If you noticed "Data" after the first iteration is exactly 100 characters long. Its whatever you received + the rest of the "dta" buffer. You must NULL terminate the buffer when you receive so you can correctly add it to "Data". You know the number of characters received, since "rcv" has that information.
So after this line...
add in this...
then you shouldn't be getting those funky characters...
Sometimes it helps if you explain the whole problem first, explain what you are using, maybe your justification as to why and add in as much information as possible...
Incidentally... this line is wrong...
if rcv is 0 then check the WSAGetLastError() function you can do this by doing something like this...
if( rcv == 0 )
int error = WSAGetLastError( );
//then find the error and print in out
TRACE1("The error I got is %d", error);
errormsg.format("I found the error %d", error);