Been working on this problem for more hours than I'd like to admit.

It seems to me it will be an easy-fix but my brain is fried over this issue.  :shock:

WSARecv keeps failing and WSAGetLastError keeps returning:

WSAEFAULT
10014   

Bad address.
    The system detected an invalid pointer address in attempting to use a pointer argument of a call. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).


WSABUF STRUCT
  len    DWORD  ?
  buf  DWORD  ?
WSABUF ENDS

AcceptConnection Proc uses ebx

      local  dwFlags:DWORD,
                dwBytes:DWORD,
                wbuf:WSABUF,
                ol:OVERLAPPED

                mov dwFlags, 0
                mov dwBytes, 0

                invoke WSARecv, .hSocket, addr wbuf, 1,  addr dwBytes,  dwFlags,  addr ol, NULL



Return Values

If no error occurs and the receive operation has completed immediately, WSARecv returns zero. Note that in this case, the completion routine will have already been scheduled, and to be called once the calling thread is in the alertable state. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code may be retrieved by calling WSAGetLastError. The error code WSA_IO_PENDING indicates that the overlapped operation has been successfully initiated and that completion will be indicated at a later time. Any other error code indicates that the overlapped operation was not successfully initiated and no completion indication will occur.

In this case WSAEFAULT.  Driving me nuts - thanks in advance.
Posted on 2007-02-28 22:09:50 by Rage9
Read up on WSABUF... null pointers are bad ;)
Posted on 2007-03-01 00:31:57 by SpooK
Wow, thanks alot!

I knew it had to be something really simple.  :D
Posted on 2007-03-01 13:47:04 by Rage9