Returns information about a service.
comm
get-service-entry service protocol &key fields => value*
service⇩ |
An integer or a string. |
protocol⇩ |
A string or nil . |
fields⇩ |
A list of keywords specifying which information is required. |
value* |
Multiple values corresponding to the keywords in fields, as described below. |
The function get-service-entry
looks up service in the system database. If service is an integer, it is the port number to look up. If service is a string, it is a name to look up (it may be one of the aliases).
If protocol is a string, then get-service-entry
looks for a system database entry with protocol protocol, otherwise it finds the first entry with any protocol.
fields specifies which information is returned. When get-service-entry
finds an entry, it returns information about it as multiple values corresponding to the keywords in fields. These keywords can be:
:name |
Return the name of the entry. |
:port |
Return the port number of the entry. |
:aliases |
Return a list of aliases of the service. |
:protocol |
Return the protocol of the entry, as lowercase strings like "tcp" or "udp". |
If service is an integer then the default value of fields is (:name)
. Otherwise the default value of fields is (:port)
.
get-service-entry
tells you what the host computer knows. The results can be quite different between computers.nil
is not the correct protocol to use.
(get-service-entry "smtp" nil) => 25
(get-service-entry 25 nil :fields '(:name :aliases)) => "smtp", ("mail")
(get-service-entry "mail" nil) => 25
25.3 Specifying the target for connecting and binding a socket
25 TCP and UDP socket communication and SSL
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:26