News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Windows socket (WSAAsyncSelect) need help...

Started by LechooY, October 12, 2006, 04:49:44 PM

Previous topic - Next topic

LechooY

Hello for All :)

I create my program in masm32 and I have litte problem by windows socket


Create socket:

   push FD_CONNECT + FD_CLOSE + FD_READ
   push WM_GG_SOCKET
   push hWnd
   push MySocket
   call WSAAsyncSelect

When I send file (Bufffer, wathever) of size >10 KB in loop (I send by 2000 bytes) then all work pefect...  :dance:

   push 0
   push eax ;2000
   push offset Buffer
   push MySocket
   call send   

instead when send fille more than 10 KB (50 KB) then I get error WSAEWOULDBLOCK (10035) :( and data is lost

My question is how I can eliminate that???

PS. Sorry for my bed english :(

Tedd

You don't need to do anything.
When using WSAAsyncSelect you can treat WSAEWOULDBLOCK as a warning only, it doesn't mean the send has failed -- this is mentioned in the documentation :P
You can see this by testing that the data is still received by whomever you send it to :wink

IF this is using a STREAM_SOCKet only. For datagram sockets, you must send in small pieces - one at a time.
No snowflake in an avalanche feels responsible.

LechooY

Yes I read this to

QuoteResource temporarily unavailable.
This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket. It is a nonfatal error, and the operation should be retried later. It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK_STREAM socket, since some time must elapse for the connection to be established.

But its not work.. maybe I do some error maybe somebody have than same bug? Maybe a must use Blocking socket?

James Ladd

The framework (WSA) is telling you that the operation would block.
In simple terms: This is because either the send needs to wait for space to be available in a send buffer, or because a read is
being done, but there is no data to read yet.

Since the example you mention has a "send" my question is , "what is at the other end receiving the data?"

If the other end isnt reading the data then there is going to be a block until it does.

LechooY

I'm stupid idiot!  :dazzled:


I fund error. Thanks for help.

James Ladd