serversocket - instantiated by Servers to act as its socket
talking to Clients
This subclass of SocketIO is instantiated by the Server
program, one for each connected Client. When connected there
are thus a one-to-one correspondence between a ServerSocket
object and a ClientSocket object.
See the users manual in simioprocess.ps
Boris Magnusson, Lund Institute of Technology.
SocketIO class ServerSocket;
Object used by Server to acually talk to a Client. The
parameter, Channel, is normally the result returned by a
call to SocketService.NextRequest.
ServerSocket object is also similar to a Simula file object.
The address of the ClientSocket object it will be connected
to is, however, not known beforehand since the Client will
take the initiative to call the Server. The `Open' operation
is usually not called directly by the application program
but is called by the NextRequest operation in SocketService.
As a result the address of the ServerSocket is defined (as
an InternetAddress object denoting the connected Client
machine). Also notice that if Sockets are not propperly
closed, say if the program is terminated due to some error,
it takes a while (some minutes) for Unix to realize that
processes using the Socket are gone. In the meantime it is
not possible to start a new Server using the same Port
number. Operations for I/O are those described in SocketIO.
Super: SocketConnection, SocketBasics.
Init: SocketSwitch.NextRequest calls Open.
: (IsOpen / Open (GetChannelNo/GetClientAddress/<IO-ops>)*
: <IO-ops>=(OutRecord / InRecord / EndFile)* /
: (Read / Write / EndFile)*
integer ChannelNumber; ! Unix Channel, from by 'Accept'
ref(InterNetAddress) InternetAdr; ! Address of Client
that connected to us;
Initiate this object as open as a result of an succesfull
call to Accept. This is managed by NextRequest in class
SocketSwitch, so there is no need to call this operation
ref(InterNetAddress) procedure GetClientAddress;
Return the Internet address of the Client this Socket is