eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'SunRPC::PortMapperClient':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: PortMapperClient (in SunRPC)


Inheritance:

   Object
   |
   +--SunRPC::RPCEndPoint
      |
      +--SunRPC::RPCClient
         |
         +--SunRPC::PortMapperClient

Package:
stx:goodies/communication
Category:
Net-Communication-SunRPC
Version:
rev: 1.20 date: 2021/01/20 14:56:16
user: cg
file: SunRPC_RPCPortMapper.st directory: goodies/communication
module: stx stc-classLibrary: communication

Description:


interface to the portmapper; see RFC1057 and examples.

copyright

COPYRIGHT (c) 2002 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

constants
o  PROTO_TCP

o  PROTO_UDP

o  knownProgramNumbers

spec
o  xdr


Instance protocol:

helpers
o  protocolNumberFor: symbolicOrNumericProtocol

operations
o  callit: call_args

o  dump
return a dump-list of the portmappers state.
roughly equivalent to 'rpcinfo -p' unix command

Usage example(s):

     |mapper list|

     mapper := self toHost:'localhost'.
     list := mapper dump.
     mapper close.
     list inspect

o  getport: mapping
get the port for a (program version protocol) tuple

Usage example(s):

     |mapperClient port arg|

     mapperClient := self toHost:'alan'. 
     arg := Dictionary new
                at:'prog' put:100000;
                at:'vers' put:2;
                at:'prot' put:#tcp;
                at:'port' put:nil;
                yourself.

     port := mapperClient getport:arg.
     mapperClient close.
     port   

o  set: mapping
register a port for a (program version protocol port) tuple

Usage example(s):

     |mapperClient arg ok|

     mapperClient := self toHost:'localhost'. 
     arg := Dictionary new
                at:'prog' put:200000;
                at:'vers' put:1;
                at:'prot' put:#tcp;
                at:'port' put:3333;
                yourself.
     ok := mapperClient set:arg.
     mapperClient close.
     ok        

     (self toHost:'localhost') dump; close

o  unset: mapping
unregister a port for a (program version protocol) tuple

Usage example(s):

     |arg mapperClient ok|

     mapperClient := (self toHost:'localhost'). 
     arg := Dictionary new
                at:'prog' put:200000;
                at:'vers' put:1;
                at:'prot' put:#tcp;
                yourself.
     ok := mapperClient unset:arg.
     mapperClient close.
     ok      

     (self toHost:'localhost') dump; close

operations - convenient interface
o  dumpAndShow
dump the portmapper information.
roughly equivalent to 'rpcinfo -p' unix command

Usage example(s):

     (self toHost:'localhost') dumpAndShow; close

o  getportForProgram: programNr version: vsnNr protocol: prot
get the port for a (program version protocol) tuple.
prot must be one of #tcp or #udp

Usage example(s):

     |mapperClient port|

     mapperClient := self toHost:'alan'. 
     port := mapperClient getportForProgram:100000 version:2 protocol:#tcp.
     mapperClient close.
     port

o  setProgram: programNr version: vsnNr protocol: prot port: portNr
register a port for a (program version protocol) tuple

Usage example(s):

     |mapperClient ok|

     mapperClient := (self toHost:'localhost'). 
     ok := mapperClient setProgram:200000 version:1 protocol:#tcp port:3333.
     mapperClient close.
     ok

     (self toHost:'localhost') dump; close

o  unsetProgram: programNr version: vsnNr protocol: prot
unregister a port for a (program version protocol) tuple

Usage example(s):

     |mapperClient ok|

     mapperClient := (self toHost:'localhost'). 
     ok := mapperClient unsetProgram:200000 version:1 protocol:#tcp.
     mapperClient close.
     ok      

     (self toHost:'localhost') dump; close

queries
o  portNumber

o  protocol


Examples:


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]


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 06:49:05 GMT