%SS_GETSERVBYNAME
Return the port number given the service name
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
USupported on UNIX
|
VSupported on OpenVMS
|
status = %SS_GETSERVBYNAME(service, [type], port, protocol)
Return value
status
Returns SS_SUCCESS (0) or one of the errors in Error codes returned by %SS_GETSERVBYNAME below. (n)
Arguments
service
The service name for which to return a port number. (a)
type
(optional) One of the following types of protocols to access the service: (a)
tcp = Transmission control protocol.
udp = User datagram protocol.
port
Returned with the port number for the specified service. (n)
protocol
Returned with the name of the network protocol for the specified service. (a)
Discussion
%SS_GETSERVBYNAME gets the port and network protocol from the services file for the specified service name (and optional protocol type). This file is the TCP/IP services file on Windows; the /etc/services file on UNIX; and sys$system:tcpip$services.dat on OpenVMS. (On OpenVMS, this is not a text file that you can edit directly as is the case on Windows and UNIX; rather it’s a binary file, which can be edited with sys$manager:tcpip$config.com.)
If type is not specified, the first match is returned, and protocol will be either “tcp” or “udp.”
If SS_ENULL is returned, the system error code can be returned by immediately calling %SYSERR.
Error codes returned by %SS_GETSERVBYNAME
See the Socket Errors table for additional information about these errors.
SS_EINTR
SS_ENETDOWN
SS_ENULL
SS_HOST_NOT_FOUND
SS_NO_DATA
SS_NO_RECOVERY
SS_TRY_AGAIN
Examples
The example below returns the port and protocol for the vtxnet service.
status = %ss_getservbyname("vtxnet",, port, proto)