Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Reverse of Socket::getservbyname?
Aquila
12/19/2004 4:18:00 PM
Is there a way to resolve ports by using some method of Socket?
I could parse /etc/services but I'd rather like to use existing methods...
--
"May the source be with you"
1 Answer
mfuhr
12/20/2004 4:06:00 AM
0
Aquila <braempje@netscape.net> writes:
> Is there a way to resolve ports by using some method of Socket?
> I could parse /etc/services but I'd rather like to use existing methods...
The C function is getservbyport() but I don't see it implemented
in Socket, at least not in Ruby 1.8.2. Socket.getnameinfo appears
to work:
irb(main):002:0> Socket.getnameinfo([nil, 80, nil])
=> ["localhost", "http"]
--
Michael Fuhr
http://www.fuhr.o...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Reverse of Socket::getservbyname?
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