Getting BlockingIOError (WinError 10035) when accepting a socket
<p>I've gotten a chance to work again with Python, but this time I decided to take Python 3.5 to my journey.</p>

<p>I had to port a working non-blocking socket server using <a href="http://www.tornadoweb.org/en/stable/" rel="nofollow">Tornado</a>, from Python 2.7 to 3.5. Used same source code, but this time it doesn't work as needed.</p>

<p>I keep getting <code>[WinError 10035] A non-blocking socket operation could not be completed immediately on send</code> whenever I accept a socket connection using <code>socket.accept()</code> and I still can't figure out why.</p>

<p>Tried to use example <a href="https://gist.github.com/robcowie/974695" rel="nofollow">code that I've found a few years ago on GitHub Gist</a> and still keep getting an error. Is there any changes in socket library or is it just a bug?</p>

<p>This error is harmless and expected. The problem is that the gist you linked to doesn't know about windows-specific error codes (on line 24 it checks for EWOULDBLOCK and EAGAIN, but it should also use WSAEWOULDBLOCK).</p>

<p>Since that gist was written, Tornado has gained some new utilities to make this easier. If you're using <code>IOStreams</code>, you can use <code>tornado.tcpserver.TCPServer</code> to accept your connections, or if you want to continue using plain sockets you can use the lower-level <code>tornado.netutil.add_accept_handler</code>. </p>

python sockets tornado nio