|
Class: DemoClient (in SunRPC)
Object
|
+--SunRPC::RPCEndPoint
|
+--SunRPC::RPCClient
|
+--SunRPC::DemoClient
- Package:
- stx:goodies/communication
- Category:
- Net-Communication-SunRPC-Demos
- Version:
- rev:
1.11
date: 2022/09/09 12:55:03
- user: stefan
- file: SunRPC_DemoClient.st directory: goodies/communication
- module: stx stc-classLibrary: communication
a simple rpc-demo client;
supports a few simple procedures:
showOnTranscript - display a message on a remote transcript
showMultipleOnTranscript - display a collection of strings on a remote transcript
showPerson - example for a structured type object being passed
and shown on a remote transcript
first, start the demoServer (on any machine) with:
SunRPC::DemoServer start
or using UDP:
SunRPC::DemoServer startUDP
then, connect to it, and execute a remote procedure call:
|hostName client message reply|
message := 'hello world'.
hostName := Dialog request:'Host ?' initialAnswer:'localhost'.
client := SunRPC::DemoClient toHost:hostName protocol:#tcp port:nil.
client showOnTranscript:message.
client close.
or using UDP:
|hostName client message reply|
message := 'hello world'.
hostName := Dialog request:'Host ?' initialAnswer:'localhost'.
client := SunRPC::DemoClient toHost:hostName protocol:#udp port:nil.
client showOnTranscript:message.
client close.
copyrightCOPYRIGHT (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.
spec
-
xdr
-
operations
-
showMultipleOnTranscript: aStringCollection
-
|client messages reply|
messages := #( 'line1' 'line2' 'line3' 'line4' ).
client := SunRPC::DemoClient new host:'localhost'.
reply := client showMultipleOnTranscript:messages.
client close.
reply.
Usage example(s):
|client messages reply|
messages := #( 'line1' 'line2' 'line3' 'line4' ).
client := SunRPC::DemoClient new host:'localhost' port:44400.
reply := client showMultipleOnTranscript:messages.
client close.
reply.
|
-
showOnTranscript: aString
-
|client message reply|
message := 'hello world'.
client := SunRPC::DemoClient new host:'localhost'.
reply := client showOnTranscript:message.
client close.
reply.
-
showPersonOnTranscript: aPerson
-
|client person reply|
person := Dictionary new
at:'firstName' put:'James';
at:'lastName' put:'Miller';
yourself.
client := SunRPC::DemoClient new host:'localhost'.
reply := client showPersonOnTranscript:person.
client close.
reply.
|