int HandleIO(SOCKET_OBJ *sock, BUFFER_OBJ *buf, DWORD BytesTransfered, DWORD error)
{
BUFFER_OBJ *recvobj=NULL, // Used to post new receives on accepted connections
*sendobj=NULL; // Used to post new sends for data received
BOOL bCleanupSocket;
int rc,
i;
// Post the specified number of receives on the succeeded connection
for(i=0; i < gOverlappedCount ;i++)
{
cout<<"read";
recvobj = GetBufferObj(gBufferSize);
if (PostRecv(sock, buf) != NO_ERROR)
{
// In the event the recv fails, clean up the connection
FreeBufferObj(buf);
// bCleanupSocket = TRUE;
error = SOCKET_ERROR;
}
}
else
{
// Graceful close - the receive returned 0 bytes read
sock->bClosing = TRUE;