net-service port not service?

Started by kanen, April 02, 2010, 04:23:36 PM

Previous topic - Next topic

kanen

I like net-service:
net-service
syntax: (net-service str-service str-protocol)
Makes a lookup in the services database and returns the standard port number for this service.
Returns nil on failure.
 (net-service "ftp" "tcp") --> 21


But, I would like to be able to specify a port, not a service name, and get the name back. Right now, I have code that parses the "services" file and does this.



(net-service "" "tcp" 21)  --> ftp
syntax: (net-service str-service str-protocol port-number)
Returns nil on failure or the name of the service.


Thoughts?
. Kanen Flowers http://kanen.me[/url] .

Lutz

#1
that was easy to add:


newLISP v.10.2.2 on Win32 IPv4, execute 'newlisp -h' for more info.

> (net-service 22 "tcp")
"ssh"
> (net-service "ssh" "tcp")
22
>


I will post a development version 10.2.2 when back from Europe on the 22nd/23rd of of April.