|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectus.ihmc.mockets.ServerMocket
public class ServerMocket
The main class for a server application to use the Mockets communication library. Similar in functionality to a server socket - used by a server to accept connections from client applications.
| Constructor Summary | |
|---|---|
ServerMocket(int port)
Creates a new ServerMocket and binds it to the specified port on localhost
ready to accept incoming connections. |
|
ServerMocket(int port,
java.lang.String listenAddr)
Creates a new ServerMocket and binds it to the specified address
ready to accept incoming connections. |
|
| Method Summary | |
|---|---|
Mocket |
accept()
Listens for a connection to be made and accepts it. |
int |
close()
Closes the current open connection to a remote endpoint. |
protected void |
finalize()
Removes the ServerMocket object. |
java.lang.String |
getIdentifier()
Returns the identifier for this mocket instance. |
int |
getLocalPort()
Return the port where the ServerMocket is listening for connections. |
void |
setIdentifier(java.lang.String identifier)
Sets a string to use as the application or user friendly identifier for this mocket instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ServerMocket(int port)
throws java.io.IOException,
java.lang.IllegalArgumentException
ServerMocket and binds it to the specified port on localhost
ready to accept incoming connections.
Specifying a value of 0 for the port causes a random port to be allocated.
port - integer value specifying the listening port. A value of 0 causes a random port to be allocated.
java.io.IOException
java.lang.IllegalArgumentException
public ServerMocket(int port,
java.lang.String listenAddr)
throws java.io.IOException,
java.lang.IllegalArgumentException
ServerMocket and binds it to the specified address
ready to accept incoming connections.
Specifying a value of 0 for the port causes a random port to be allocated.
port - integer value specifying the listening port. A value of 0 causes a random port to be allocated.listenAddr - string value specifying the host's listening address. The hostname will be resolved.
java.io.IOException
java.lang.IllegalArgumentException| Method Detail |
|---|
public int getLocalPort()
ServerMocket is listening for connections.
ServerMocket is listening.protected void finalize()
ServerMocket object.
finalize in class java.lang.Object
public Mocket accept()
throws java.io.IOException,
java.lang.IllegalArgumentException
Mocket is created.
mocket created;
NULL if an error occurred.
java.io.IOException
java.lang.IllegalArgumentException
public int close()
throws java.io.IOException,
java.lang.IllegalArgumentException
0
java.io.IOException
java.lang.IllegalArgumentExceptionpublic void setIdentifier(java.lang.String identifier)
identifier - string to be used to identify this mocket instance.public java.lang.String getIdentifier()
NULL if no identifier is set.setIdentifier(java.lang.String)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||