socket.send : (11, 'Resource temporarily unavailable')

G

Gabriel Rossetti

Hello everyone,

I get a (11, 'Resource temporarily unavailable') error when I try to
send a file using a socket. Is there s size limit? I tried sending a
smaller file and ii poses no problem. Am I doing something wrong? Here
is the code:

def sendMessage(host, port, msg):

if isinstance(msg, unicode):
msg = msg.encode("utf-8")

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host, port))
sock.setblocking(0)
totalsent = 0
while totalsent < len(msg):
sent = sock.send(msg[totalsent:])
if sent == 0:
raise RuntimeError, "socket connection broken"
totalsent = totalsent + sent
sock.close()

Thank you,
Gabriel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top