Thursday 15 April 2010

c# - WouldBlock is passed to ReceiveAsync callback -



c# - WouldBlock is passed to ReceiveAsync callback -

i utilize non-blocking send , receiveasync receiving.

var r = new socketasynceventargs(); r.completed += _receiveargs_completed; r.setbuffer(new byte[chunksize], 0, chunksize); client.client.receiveasync(r); // homecoming value check omitted void _receiveargs_completed(object sender, socketasynceventargs e) { if (e.socketerror == socketerror.wouldblock) { console.writeline("async receive block, wtf? " + environment.stacktrace); return; } ... }

with ms .net runs fine in unity (which uses mono 2.6) gets wouldblock.

beginreceive works has other problems want seek receiveasync.

how possible?

don't utilize non-blocking , asynchronous together. it's pointless. asynchronous inherently non-blocking, , works fine on own.

if set socket non-blocking, every effort receive finish immediately. either data, or socketerror.wouldblock.

frankly, no .net programme should ever utilize non-blocking sockets. way utilize non-blocking sockets correctly poll socket, , polling wasteful , unnecessary, given back upwards asynchronous operations .net offers.

c# sockets tcp unity3d mono

No comments:

Post a Comment