|
Class: PortMapperClient (in SunRPC)
Object
|
+--SunRPC::RPCEndPoint
|
+--SunRPC::RPCClient
|
+--SunRPC::PortMapperClient
- Package:
- stx:goodies/communication
- Category:
- Net-Communication-SunRPC
- Version:
- rev:
1.19
date: 2017/11/18 09:51:02
- user: cg
- file: SunRPC_RPCPortMapper.st directory: goodies/communication
- module: stx stc-classLibrary: communication
- Author:
- Claus Gittinger
interface to the portmapper; see RFC1057 and examples.
RFC1057
constants
-
PROTO_TCP
-
-
PROTO_UDP
-
-
knownProgramNumbers
-
spec
-
xdr
-
helpers
-
protocolNumberFor: symbolicOrNumericProtocol
-
operations
-
callit: call_args
-
-
dump
-
return a dump-list of the portmappers state.
roughly equivalent to 'rpcinfo -p' unix command
-
getport: mapping
-
get the port for a (program version protocol) tuple
-
set: mapping
-
register a port for a (program version protocol port) tuple
-
unset: mapping
-
unregister a port for a (program version protocol) tuple
operations - convenient interface
-
dumpAndShow
-
dump the portmapper information.
roughly equivalent to 'rpcinfo -p' unix command
usage example(s):
(self toHost:'localhost') dumpAndShow; close
|
-
getportForProgram: programNr version: vsnNr protocol: prot
-
get the port for a (program version protocol) tuple.
prot must be one of #tcp or #udp
-
setProgram: programNr version: vsnNr protocol: prot port: portNr
-
register a port for a (program version protocol) tuple
-
unsetProgram: programNr version: vsnNr protocol: prot
-
unregister a port for a (program version protocol) tuple
queries
-
portNumber
-
-
protocol
-
Notice: windows systems have no portMapper running -
you must try these on a unix box
(or change 'localhost' to the name of a box running a real OS in your network).
connect test:
|mapper|
mapper := SunRPC::PortMapperClient toHost:'localhost'.
mapper close.
|
|mapper|
mapper := SunRPC::PortMapperClient toHost:'exeptn' protocol:#udp port:111.
mapper close.
|
dump the current mapping (same as 'rpcinfo -p' command):
|mapper|
mapper := SunRPC::PortMapperClient toHost:'exeptn'.
mapper dumpAndShow.
mapper close.
|
dump the current mapping via udp (same as 'rpcinfo -p' command):
|mapper|
mapper := SunRPC::PortMapperClient toHost:'exeptn' protocol:#udp port:111.
mapper dumpAndShow.
mapper close.
|
dump the current mapping via tcp (same as 'rpcinfo -p' command):
|mapper|
mapper := SunRPC::PortMapperClient toHost:'exeptn' protocol:#tcp port:111.
mapper dumpAndShow.
mapper close.
|
get a mapping:
|mapper port|
mapper := SunRPC::PortMapperClient toHost:'localhost'.
port := mapper getportForProgram:100000 version:2 protocol:#tcp.
mapper close.
Transcript showCR:port.
|
set a port (please validate with 'rpcinfo -p'):
|mapper ok|
mapper := SunRPC::PortMapperClient toHost:'localhost'.
ok := mapper setProgram:200000 version:1 protocol:#tcp port:33333.
mapper close.
ok ifFalse:[self error]
|
unset a port (please validate with 'rpcinfo -p'):
|mapper ok|
mapper := SunRPC::PortMapperClient toHost:'localhost'.
ok := mapper unsetProgram:200000 version:1 protocol:#tcp.
mapper close.
ok ifFalse:[self error]
|
|