Sockets - Maple Programming Help

Home : Support : Online Help : Connectivity : Web Features : Network Communication : Sockets Package : Sockets/LookupService

Sockets

 LookupService
 perform internet service to port number translations

 Calling Sequence LookupService(portOrService, proto)

Parameters

 portOrService - string indicating a service name, or positive integer specifying a port number proto - (optional) string; one of "tcp" or "udp"

Description

 • A number of standard Internet services have assigned port numbers. The procedure LookupService enables you to map service names to port numbers, and vice versa.
 • The first argument portOrService specifies the service name (as a Maple string), or a port number for a reverse lookup (as a positive integer).
 • The second argument proto is optional. It must be entered as one of the two strings "tcp" or "udp". This argument specifies the protocol for the service. The default protocol is "tcp".
 • The "official" assignments of port numbers to services is specified in the Internet standard IANA Port Number Assignments, which is part of RFC 1700 Assigned Numbers. Be aware, however, that individual hosts may (and often do) reassign these port numbers, locally.

Examples

Note: If a service is not available, an error is returned.

 > $\mathrm{with}\left(\mathrm{Sockets}\right):$
 > $\mathrm{LookupService}\left("telnet"\right)$
 ${23}$ (1)
 > $\mathrm{LookupService}\left("ftp"\right)$
 ${21}$ (2)
 > $\mathrm{LookupService}\left("smtp"\right)$
 ${25}$ (3)
 > $\mathrm{LookupService}\left("sunrpc"\right)$
 ${111}$ (4)
 > $\mathrm{LookupService}\left("finger"\right)$
 ${79}$ (5)
 > $\mathrm{LookupService}\left("echo"\right)$
 ${7}$ (6)
 > $\mathrm{LookupService}\left("echo","tcp"\right)$
 ${7}$ (7)
 > $\mathrm{LookupService}\left("echo","udp"\right)$
 ${7}$ (8)
 > $\mathrm{LookupService}\left("no such service"\right)$
 > $\mathrm{LookupService}\left(7\right)$
 ${"echo"}$ (9)

References

 Internet Assigned Numbers Authority, "IANA Port Number Assignments," IANA Home Page, http://www.iana.org/assignments/port-numbers; accessed 17 November 2005.
 Information Sciences Institute, "RFC 1700 Assigned Numbers," ISI Home Page, http://www.isi.edu/in-notes/rfc1700.txt; accessed 17 November 2005.