Is there a maximum size for the receive in a TCPSocket as in str =streamSock.recv( 64000 )?

V

Victor Reyes

[Note: parts of this message were removed to make it a legal post.]

Hello Team,

Is there a limit on the amount of data (bytes) that can be received via the
*str = streamSock.recv( 64000 )* stmt below?
Although I put *64000 *bytes, I consistently do not get more than *5562*bytes.
When this happens the server side fails with a *`write`: broken
(Errno::EPIPE)* msg.
I know that the variable, *userCMD_output* contains all the data, since I
printed to the screen for testing.

Thank you


This is the server code:

require 'socket'
port = 19557
server = TCPServer.new("", port)

while (session = server.accept)
input = session.gets
userCMD_output = `#{input}`
session.write("#{userCMD_output}")
session.close
end

This is the client code:

def runIt( srvr, comm )
require 'socket'
port = 19557
streamSock = TCPSocket.new( srvr, port )
streamSock.puts("#{comm}\n")
str = streamSock.recv( 64000 )
puts "Output from Server: #{srvr}"
print str
puts "\n"
streamSock.close
end
 
M

MonkeeSage

[Note: parts of this message were removed to make it a legal post.]

Hello Team,

Is there a limit on the amount of data (bytes) that can be received via the
*str = streamSock.recv( 64000 )* stmt below?
Although I put *64000 *bytes, I consistently do not get more than *5562*bytes.
When this happens the server side fails with a *`write`: broken
(Errno::EPIPE)* msg.
I know that the variable, *userCMD_output* contains all the data, since I
printed to the screen for testing.

Thank you

This is the server code:

require 'socket'
port = 19557
server = TCPServer.new("", port)

while (session = server.accept)
input = session.gets
userCMD_output = `#{input}`
session.write("#{userCMD_output}")
session.close
end

This is the client code:

def runIt( srvr, comm )
require 'socket'
port = 19557
streamSock = TCPSocket.new( srvr, port )
streamSock.puts("#{comm}\n")
str = streamSock.recv( 64000 )
puts "Output from Server: #{srvr}"
print str
puts "\n"
streamSock.close
end

See my reply to the last thread you posted (in short, use #read rather
than #recv).

Regards,
Jordan
 
V

Victor Reyes

[Note: parts of this message were removed to make it a legal post.]

Hey Jordan, I owe one.
It works like a charm!

Thanks again,

Victor

[Note: parts of this message were removed to make it a legal post.]

Hello Team,

Is there a limit on the amount of data (bytes) that can be received via the
*str = streamSock.recv( 64000 )* stmt below?
Although I put *64000 *bytes, I consistently do not get more than *5562*bytes.
When this happens the server side fails with a *`write`: broken
(Errno::EPIPE)* msg.
I know that the variable, *userCMD_output* contains all the data, since I
printed to the screen for testing.

Thank you

This is the server code:

require 'socket'
port = 19557
server = TCPServer.new("", port)

while (session = server.accept)
input = session.gets
userCMD_output = `#{input}`
session.write("#{userCMD_output}")
session.close
end

This is the client code:

def runIt( srvr, comm )
require 'socket'
port = 19557
streamSock = TCPSocket.new( srvr, port )
streamSock.puts("#{comm}\n")
str = streamSock.recv( 64000 )
puts "Output from Server: #{srvr}"
print str
puts "\n"
streamSock.close
end

See my reply to the last thread you posted (in short, use #read rather
than #recv).

Regards,
Jordan
 
M

MonkeeSage

[Note: parts of this message were removed to make it a legal post.]

Hey Jordan, I owe one.
It works like a charm!

Thanks again,

Victor

[Note: parts of this message were removed to make it a legal post.]
Hello Team,
Is there a limit on the amount of data (bytes) that can be received via the
*str = streamSock.recv( 64000 )* stmt below?
Although I put *64000 *bytes, I consistently do not get more than *5562*bytes.
When this happens the server side fails with a *`write`: broken
(Errno::EPIPE)* msg.
I know that the variable, *userCMD_output* contains all the data, since I
printed to the screen for testing.
Thank you
This is the server code:
require 'socket'
port = 19557
server = TCPServer.new("", port)
while (session = server.accept)
input = session.gets
userCMD_output = `#{input}`
session.write("#{userCMD_output}")
session.close
end
This is the client code:
def runIt( srvr, comm )
require 'socket'
port = 19557
streamSock = TCPSocket.new( srvr, port )
streamSock.puts("#{comm}\n")
str = streamSock.recv( 64000 )
puts "Output from Server: #{srvr}"
print str
puts "\n"
streamSock.close
end
See my reply to the last thread you posted (in short, use #read rather
than #recv).
Regards,
Jordan

Glad to be of some help! I've received enough help from the group -- I
guess it's about time to give some back. ;)

Regards,
Jordan
 

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,795
Messages
2,569,644
Members
45,357
Latest member
RuthEsteve

Latest Threads

Top