drcl.inet.socket
Class SocketContract
java.lang.Object
|
+--drcl.comp.Contract
|
+--drcl.inet.socket.SocketContract
- All Implemented Interfaces:
- SocketConstants
- public class SocketContract
- extends Contract
- implements SocketConstants
This class defines the Socket contract.
Accept
- The initiator sends a message that consists of:
- an integer of value 0 (the "accept" command),
- local address (
long),
- local port (
long).
In response, the reactor sends back the following message after a connection is established
- an integer of value 1 (the "accept-reply" message),
- connection ID (
int),
- remote address (
long),
- remote port (
long),
- TCP data port (
Port).
After connecting the data path (with the TCP data port), the initiator sends back
a null signal to notify of the establishment of the data path.
Connect
- The initiator sends a message that consists of:
- an integer of value 2 (the "connect" command),
- remote address (
long),
- remote port (
long),
- local address (
long),
- local port (
long).
In response, the reactor sends back the following message after a connection is established
- an integer of value 3 (the "connect-reply" message),
- connection ID (
int),
- TCP data port (
Port).
After connecting the data path (with the TCP data port), the initiator sends back
a null signal to notify of the establishment of the data path.
-
Close
- The initiator sends a message that consists of:
- an integer of value 4 (the "close" command) and
- connection ID (
int).
In response, the reactor closes the connection and send back a null signal.
Error
- In any of the above processes, if an error occurs, the reactor may send back an error
message instead of a normal reply. The error message consists of:
- an integer of value 5 (the "error" message) and
- description (
String).
|
Method Summary |
static SocketContract.Message |
accept(long localAddr_,
int localPort_,
Port port_)
|
static void |
close(int connectionID_,
Port port_)
|
static SocketContract.Message |
connect(long remoteAddr_,
int remotePort_,
long localAddr_,
int localPort_,
Port port_)
|
static void |
error(java.lang.String error_,
Port port_)
|
static SocketContract.Message |
getAcceptPack(long localAddr_,
int localPort_)
|
static SocketContract.Message |
getAcceptReplyPack(int connectionID_,
long remoteAddr_,
int remotePort_,
Port tcpPort_)
|
static SocketContract.Message |
getClosePack(int connectionID_)
|
static SocketContract.Message |
getConnectPack(long remoteAddr_,
int remotePort_,
long localAddr_,
int localPort_)
|
static SocketContract.Message |
getConnectReplyPack(int connectionID_,
Port tcpPort_)
|
java.lang.Object |
getContractContent()
Returns the content of this contract (format?). |
java.lang.String |
getName()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SocketContract
public SocketContract()
SocketContract
public SocketContract(int role_)
getName
public java.lang.String getName()
- Overrides:
getName in class Contract
getContractContent
public java.lang.Object getContractContent()
- Description copied from class:
Contract
- Returns the content of this contract (format?).
- Overrides:
getContractContent in class Contract
accept
public static SocketContract.Message accept(long localAddr_,
int localPort_,
Port port_)
connect
public static SocketContract.Message connect(long remoteAddr_,
int remotePort_,
long localAddr_,
int localPort_,
Port port_)
close
public static void close(int connectionID_,
Port port_)
error
public static void error(java.lang.String error_,
Port port_)
getAcceptPack
public static SocketContract.Message getAcceptPack(long localAddr_,
int localPort_)
getAcceptReplyPack
public static SocketContract.Message getAcceptReplyPack(int connectionID_,
long remoteAddr_,
int remotePort_,
Port tcpPort_)
getConnectPack
public static SocketContract.Message getConnectPack(long remoteAddr_,
int remotePort_,
long localAddr_,
int localPort_)
getConnectReplyPack
public static SocketContract.Message getConnectReplyPack(int connectionID_,
Port tcpPort_)
getClosePack
public static SocketContract.Message getClosePack(int connectionID_)
Copyright © 2001 - DRCL, OSU ~ Back to JavaSim Home ~