SSF.OS.Socket
Class socketMaster

java.lang.Object
  |
  +--SSF.OS.ProtocolSession
        |
        +--SSF.OS.Socket.socketMaster
All Implemented Interfaces:
com.renesys.raceway.DML.Configurable

public class socketMaster
extends ProtocolSession

A convenience protocol used to create TCP or UDP sockets, that is instances of SSF.OS.TCP.tcpSocket or SSF.OS.UDP.udpSocket, respectively.


Field Summary
 boolean DEBUG
           
static short EBADF
          The socket is not associated with any TCP session and cannot be used any more.
static short EBUSY
          Attemp to write to a blocking socket while another process is writing, or attempt to read from a blocking socket while another process is reading.
static short ECONNABORTED
           
static short ECONNREFUSED
          Connection request refused by peer or ICMP notification that the destination protocol or port number is unreachable at destination.
static short ECONNRESET
          Connection reset by peer.
static short EHOSTUNREACH
          ICMP notification that destination host or net is unreachable.
static short EINPROGRESS
          return from connect() in a non-blocking socket when the connection cannot be completed immediately.
static short EISCONN
          The socket is already connected.
static short ETIMEDOUT
          Connection timeout.
static short EWOULDBLOCK
          No success in a blocking call for a non-blocking socket.
 int minPortNumber
          First automatically assigned port number is minPortNumber+1.
 tcpSessionMaster tcpMaster
           
 udpSessionMaster udpMaster
           
 
Fields inherited from class SSF.OS.ProtocolSession
name, use
 
Constructor Summary
socketMaster()
           
 
Method Summary
 void config(com.renesys.raceway.DML.Configuration cfg)
          Configure the socket parameters.
static java.lang.String errorString(int errno)
           
 int getPortNumber()
          Returns the next higher automatically assigned integer port number, beginning from minPortNumber+1.
 boolean push(ProtocolMessage message, ProtocolSession fromSession)
          Routine to call when a message is being sent to ("pushed into") this ProtocolSession by another ProtocolSession.
 socketAPI socket(ProtocolSession caller, java.lang.String protocol)
          Returns a new unconnected socket for the named protocol (tcp, udp).
 
Methods inherited from class SSF.OS.ProtocolSession
close, closed, debugIdentifier, inGraph, init, open, opened, pushAfterDelay, pushAfterDelayFailed, setGraph, version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ECONNREFUSED

public static final short ECONNREFUSED
Connection request refused by peer or ICMP notification that the destination protocol or port number is unreachable at destination.

See Also:
Constant Field Values

ECONNRESET

public static final short ECONNRESET
Connection reset by peer.

See Also:
Constant Field Values

ETIMEDOUT

public static final short ETIMEDOUT
Connection timeout.

See Also:
Constant Field Values

ECONNABORTED

public static final short ECONNABORTED
See Also:
Constant Field Values

EWOULDBLOCK

public static final short EWOULDBLOCK
No success in a blocking call for a non-blocking socket.

See Also:
Constant Field Values

EISCONN

public static final short EISCONN
The socket is already connected.

See Also:
Constant Field Values

EINPROGRESS

public static final short EINPROGRESS
return from connect() in a non-blocking socket when the connection cannot be completed immediately.

See Also:
Constant Field Values

EHOSTUNREACH

public static final short EHOSTUNREACH
ICMP notification that destination host or net is unreachable.

See Also:
Constant Field Values

EBUSY

public static final short EBUSY
Attemp to write to a blocking socket while another process is writing, or attempt to read from a blocking socket while another process is reading.

See Also:
Constant Field Values

EBADF

public static final short EBADF
The socket is not associated with any TCP session and cannot be used any more.

See Also:
Constant Field Values

tcpMaster

public tcpSessionMaster tcpMaster

udpMaster

public udpSessionMaster udpMaster

minPortNumber

public int minPortNumber
First automatically assigned port number is minPortNumber+1.


DEBUG

public boolean DEBUG
Constructor Detail

socketMaster

public socketMaster()
Method Detail

errorString

public static final java.lang.String errorString(int errno)

config

public void config(com.renesys.raceway.DML.Configuration cfg)
            throws com.renesys.raceway.DML.configException
Configure the socket parameters. Supported DML attributes are:
 ProtocolSession [name socket use SSF.OS.Socket.socketMaster
   debug    %S               # if true, print verbose TCP diagnostics
 ]
 

Specified by:
config in interface com.renesys.raceway.DML.Configurable
Overrides:
config in class ProtocolSession
com.renesys.raceway.DML.configException

socket

public socketAPI socket(ProtocolSession caller,
                        java.lang.String protocol)
                 throws ProtocolException
Returns a new unconnected socket for the named protocol (tcp, udp).

Parameters:
caller - protocol session instance which requests the socket
protocol - transport protocol name, which must be either "tcp" or "udp"
ProtocolException

getPortNumber

public int getPortNumber()
Returns the next higher automatically assigned integer port number, beginning from minPortNumber+1. Maximum value is Integer.MAX_VALUE.


push

public boolean push(ProtocolMessage message,
                    ProtocolSession fromSession)
             throws ProtocolException
Description copied from class: ProtocolSession
Routine to call when a message is being sent to ("pushed into") this ProtocolSession by another ProtocolSession. The pusher sends a reference to itself in the second argument. This push happens immediately, without any simulation time elapsing, regardless of other activities taking place in the ProtocolGraph.

If you desire "safe" interaction with other CPU activities, even though your push() consumes no measurable/modelable CPU cycles, define the "cpudelay true" attribute for the ProtocolGraph and use pushAfterDelay(message,fromSession,0.0). This will guarantee proper ordering; that is, the framework will wait until the CPU is free before proceeding with the requested push().

Specified by:
push in class ProtocolSession
ProtocolException