Resource: RNetConnection


resource RNetConnection
   // Resource representing a two-ended connection from this host to another.
   requires RNetListenerRNetAddress;

   state
       local: RNetAddress;  
       remote: RNetAddress;

   operations
       RNetConnection (r: RNetAddress)
           "Constructs an RNetConnection object for communication with
            the specified port on the specified host."

           { remote = r; }  

       RNetConnection (l: RNetAddress, r: RNetAddress)
           "Constructs an RNetConnection object for communication with
            the specified port on the specified host."

           { local = l; remote = r; } // check local matches!

       setLocalAddress (l: RNetAddress)
          "Called by other resources to set the state of this object."
           { local = l; }

       setRemoteAddress (r: RNetAddress)
          "Called by other resources to set the state of this object."
          { remote = r; }

   observers
       getLocalAddress () returns RNetAddress 
          { return local; } 
 
       getRemoteAddress () returns RNetAddress
          { return remote; }

About this file

Naccio Home Page
David Evans
University of Virginia, Computer Science