I have a problem here. My program used a structure similar to the following:
@session=TCPSocket.new(mypopserver,110)
while resp=@session.gets do
blah blah
end
It worked perfect in single user mode. While I put the code into a thread, I
encountered problem: a lot of thread got resp=nil, and jumped out of the
while loop.
My question is: I just connected to the socket, and everything seems fine,
why gets return nil? why the socket reaches eof? Please note that in single
user mode it is ok.
@session=TCPSocket.new(mypopserver,110)
while resp=@session.gets do
blah blah
end
It worked perfect in single user mode. While I put the code into a thread, I
encountered problem: a lot of thread got resp=nil, and jumped out of the
while loop.
You’ll have to tell a bit more. how many sockets do you open? and how many
threads? I don’t want to know what Ruby does when those two numbers are
unequal…
As usual I need information about your platform, your Ruby version,
and preferably error reproducing script. I couldn’t reproduce similar
error using 1.8.0 2003-03-28.
···
In message “gets from socket got eof (multithread)” on 03/04/02, “Shannon Fang” xrfang@hotmail.com writes:
Hi all,
I have a problem here. My program used a structure similar to the following:
@session=TCPSocket.new(mypopserver,110)
while resp=@session.gets do
blah blah
end
It worked perfect in single user mode. While I put the code into a thread, I
encountered problem: a lot of thread got resp=nil, and jumped out of the
while loop.
My question is: I just connected to the socket, and everything seems fine,
why gets return nil? why the socket reaches eof? Please note that in single
user mode it is ok.