views:

55

answers:

1

We have server on Python and client + web service on Ruby. That works only if file from URL is less than 800 k. It seems like "socket.puts data" in a client works, but "output = socket.gets" - not. I think problem is in a Python part. For big files tests run "Connection reset by peer". Is it buffer size variable by default somewhere in a Python?

A: 

Could you add a little more information and code to your example?

Are you thinking about sock.recv_into() which takes a buffer and buffer size as arguments? Alternately, are you hitting a timeout issue by failing to have a keepalive on the Ruby side?

Guessing in advance of knowledge.

Charles Merriam
Thank you for your response! Finally I did it by using loops and getting chunks both on the Ruby and the Python sides. That works.Ruby:<code> output = "" while !socket.eof? do output = output + socket.read(1024) end</code>Python:<code>def handle(self): total_data = [] while 1: data = self.request.recv(1024) if len(data) < 1024: total_data.append(data) break total_data.append(data) t_data = ''.join(total_data)</code>
Anna