Re: recv how to

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Arkady Frenkel napisał(a):
Hi!
"Przemek" <edgarus@xxxxxxxxxxxxxxxxxx> wrote in message news:ej5f7f$im0$1@xxxxxxxxxxxxxxxxxxxxxxx
Hi all,

Two things:

1.
I need to recieve an email header, and I need to do it in one thread,
I'm sending top command to server to get header but it's not complite.

Continue to read up to you have all the data

Ok but how to do that? I've tried a microsoft example from msdn, and it freezes host application (I'm writting a plugin for internet communcator).
I've tried this:

while( bytesRecv != SOCKET_ERROR ) {
bytesRecv = recv( ConnectSocket, recvbuf, 32, 0 );
if ( bytesRecv == 0 || WSAGetLastError() == WSAECONNRESET ) {
printf( "Connection Closed.\n");
break;
}
printf( "Bytes Recv: %ld\n", bytesRecv );
}

In my app buffer has 2KB.

When I connect to pop3 server, and get messages count, and try to get first message, this code freezes my app. However when it try to get the second email, it's very fast. But at the fist time it gets no data.
The second thing is that, when my code is running, the host application has problem with network.

Przemek
.