FU Berlin AG Netzbasierte Informationssysteme / Networkbased Informationsystems
Institut für Informatik, Fachbereich Mathematik und Informatik, Freie Universität Berlin







How to write a client for XMLSpaces.Net

In order to write a client for XMLSpaces.Net two tasks have to be done as follows. For each application the .Net framework defines an XML-file which holds configuration information, which is mostly named the same as the application (executable file) and the suffix ".exe.config". In order to create a working client the first thing to do is to modify that config file. Using the example that is provided for download, one only has to change the serveradress in the confg-file of the clients.

Example :
<configuration>
    <system.runtime.remoting>
        <application name="[CLIENTNAME]">
               <client>
                    <wellknown 
                         type="XMLTupleSpaceShare.XMLServer, XmlTupleSpaceShared"
                       url="[URL_WITH_PORT]/XMLTupleSpace" />
            </client>
        </application>
...
    <system.runtime.remoting>
<configuration>

CLIENTNAME
the clients programmname (application-name)
URL_WITH_PORT is the http address where the server resides and the port the server is listening on.

Only if more templates are implemented, the config-file needs to be modified furter. For any new template that is added, the client's config-file needs a new entry in order to tell the remoting-framework to handle the background processes.

These two lines of code are necessary to load the configuration-file:
TupleSpaceConfiguraton tsconfiguration = new TupleSpaceConfiguraton([PATH_TO_CONFIGFILE]);
RemotingConfiguration.Configure([PATH_TO_CONFIGFILE]);

In order to access or create a tuplespace, the client has to
  1. acquire a server-object :
    XMLServer myServer = (XMLServer) RemotingServices.Connect(typeof(XMLServer), tsconfiguration.getUri().ToString());
  2. create/connect to a TupleSpace :
    XMLTupleSpace ts = myServer.createTSpace([TUPLESPACE-NAME]);
    or
    XMLTupleSpace ts = myServer.connectTSpace([TUPLESPACE-NAME]);
After these two steps ts.input(), ts.output(), ts.read() are available for tuplespace operations.