Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Select
Eder Quiñones
8/27/2007 10:04:00 PM
Hi, I'm working with sockets and I want to know when I'm able to send
and receive data, this is what I Have:
def receive
select(nil, [@socket], nil, 0)
end
def send
select([@socket], nil, nil, 0)
end
Anyone knows how to improve this?.
--
Posted via
http://www.ruby-...
.
2 Answers
Phlip
8/27/2007 10:14:00 PM
0
Eder Quic3b1ones wrote:
> def receive
> select(nil, [@socket], nil, 0)
> end
Why aren't you using a high-level library which wraps that stuff?
--
Phlip
http://www.oreilly.com/catalog/9780...
^ assert_xpath
http://tinyurl....
<-- assert_raise_message
Roger Pack
8/28/2007 6:01:00 PM
0
Eder Quiñones wrote:
> Hi, I'm working with sockets and I want to know when I'm able to send
> and receive data, this is what I Have:
>
> def receiveableRightNow
> r,w,e = select([@socket], nil, nil, 0)
return !r.empty? # r is an array -- if it has @socket in it then
@socket is able to receive
end
I think :)
That's how I do it. If there's a better way like a built in function I
dunno.
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Select
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password