Re: read/select not blocking on SSL socket?
- From: grocery_stocker <cdalten@xxxxxxxxx>
- Date: Thu, 30 Aug 2007 17:58:13 -0700
On Aug 30, 1:20 pm, "yer...@xxxxxxxxx" <yer...@xxxxxxxxx> wrote:
I'm working on an SSL client/server application using persistent TLSv1
connections. I'm having some issues with my server and what I think
should be a blocking read or select.
I also understood Ruby io.read to be blocking.
I'm basically doing this where @io is an OpenSSL::SSL::SSLSocket:
until @data.length == READ_SIZE do
tmp = @io.read(READ_SIZE - @data.length)
if tmp.nil?
IO.select [@io]
else
@data << tmp
end
end
(I did not initially have the select call, but decided to give that a
try.)
I would expect that the read would block (I have not set O_NONBLOCK on
the socket) until there is data to be read. Instead, when there is no
data, every read call returns nil. I thought the select would fix
that, but it returns immediately and the read call again returns nil.
Am I misunderstanding how this should work? Would the fact that it's
an SSL connection cause the issue?
I'm using 1.8.4 on Linux.
Thanks for any insights you can offer.
Jeremy
Maybe I'm not the best person to be giving advice, but I don't think
your do/end is a legal Ruby construction.
I was under the impression you would use do/end like the following
sock.each_line do |line|
puts line
end
Notice the nifty | | thingies. This will read each line and then
return.
Chad
.
- Follow-Ups:
- Re: read/select not blocking on SSL socket?
- From: grocery_stocker
- Re: read/select not blocking on SSL socket?
- References:
- read/select not blocking on SSL socket?
- From: yermej@xxxxxxxxx
- read/select not blocking on SSL socket?
- Prev by Date: Re: rubygame
- Next by Date: Re: rubygame
- Previous by thread: Re: read/select not blocking on SSL socket?
- Next by thread: Re: read/select not blocking on SSL socket?
- Index(es):
Relevant Pages
|