5

I have a strange problem. Trying to write a network app in python. Currently I am using osx and I have troubles with sockets. My code works fine on debian, but when I try to use recv(buff_size) on a connected tcp socket I get this error:
socket.error: [Errno 35] Resource temporarily unavailable

1 Answer 1

6

Are you using non-blocking sockets, or timeouts? According to this table, Errno 35 is EAGAIN on OSX; according to Apple man pages recv(2):

[EAGAIN]

The socket is marked non-blocking, and the receive operation would block, or a receive timeout had been set, and the timeout expired before data were received.

It could also be possible that socket.setdefaulttimeout was called with non-zero value (in which case socket.getdefaulttimeout would return non-none value.


See also Spurious recv() EAGAIN on OSX?; Blocking socket returns EAGAIN.

Sign up to request clarification or add additional context in comments.

4 Comments

I didn't set sockets to be either blocking or non blocking. I thought they are blocking by default. When I have set it manually to blocking, it works.
But in an example, that I got from some tutorial I don't see setting socket to blocking and yet recv() just blocks the socket till something comes to the socket.
Yeah, I'd expect them to be blocking as well, but maybe something else is setting a default.
What confuses me most, is that on debian it is blocking by default, on mac sometimes it is blocking when You don't specify and sometimes not. Messy. But it teaches user, to always take care of everything and make sure, that everything is how he wants it to be

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.