I have met a problem when I use IOCP in x64 platform.
When I compile my code in win32 platform, it runs well. But when I change it to x64 platform, function
GetQueuedCompletionStatus(CompletionPort, &BytesTransferred,(PULONG_PTR)&PerHandleData, (LPOVERLAPPED*)&IpOverlapped, INFINITE)
returnes true without pass the value to PerHandleData.
PerHandleData is defined as:
typedef struct
{
SOCKET socket;
SOCKADDR_STORAGE ClientAddr;
}PER_HANDLE_DATA,*LPPER_HANDLE_DATA;
LPPER_HANDLE_DATA PerHandleData;
That means, even if there seems no error with the function GetQueuedCompletionStatus() , struct PerHandleData can not read memory: socket can not read memory and so does ClientAddr. There is no values.
So when it runs to function WSARecv(PerHandleData->socket, &(PerIoData->databuff), 1, &RecvBytes, &Flags, &(PerIoData->overlapped), NULL)
; the application will stop for memory errors.
Who can tell me how to deal with it?