soc.server.genericServer
Class Server.NetStringServerSocket

java.lang.Object
  extended by soc.server.genericServer.Server.NetStringServerSocket
All Implemented Interfaces:
StringServerSocket
Enclosing class:
Server

protected class Server.NetStringServerSocket
extends java.lang.Object
implements StringServerSocket

Uses ServerSocket to implement StringServerSocket over a network.


Field Summary
private  java.net.ServerSocket implServSocket
           
private  Server server
           
 
Constructor Summary
Server.NetStringServerSocket(int port, Server serv)
           
 
Method Summary
 StringConnection accept()
          For server to call.
 void close()
          Close down server socket immediately: Do not let inbound data drain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

implServSocket

private java.net.ServerSocket implServSocket

server

private Server server
Constructor Detail

Server.NetStringServerSocket

public Server.NetStringServerSocket(int port,
                                    Server serv)
                             throws java.io.IOException
Throws:
java.io.IOException
Method Detail

accept

public StringConnection accept()
                        throws java.net.SocketException,
                               java.io.IOException
Description copied from interface: StringServerSocket
For server to call. Blocks waiting for next inbound connection.

Specified by:
accept in interface StringServerSocket
Returns:
The server-side peer to the inbound client connection
Throws:
java.net.SocketException - if our setEOF() has been called, thus new clients won't receive any data from us
java.io.IOException - if network has a problem accepting

close

public void close()
           throws java.io.IOException
Description copied from interface: StringServerSocket
Close down server socket immediately: Do not let inbound data drain. Accept no new inbound connections. Send EOF marker in all current outbound connections. Like java.net.ServerSocket, any thread currently blocked in accept() must throw a SocketException.

Specified by:
close in interface StringServerSocket
Throws:
java.io.IOException