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
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