|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ascert.comms.driver.farsite.X25SocketImpl
Contains the X25Socket
implementation for the FarSync range of X.25 cards.
Field Summary | |
static java.lang.String |
FARSITE_DIAG_PROPERTY
System property controlling whether diagnostics are produced to System.out . |
Fields inherited from interface com.ascert.comms.x25.X25Socket |
X25_CUD_LENGTH, X25_NUA_ADDRLEN |
Constructor Summary | |
protected |
X25SocketImpl()
General constructor to create and initialise a new X.25 socket. |
Method Summary | |
X25Socket |
accept()
Accept a new incoming X.25 SVC (switched virtual circuit) connection on a server socket. |
void |
bind(java.lang.String localAddr)
Binds a socket to a specific local NUA. This method is typically used to bind server sockets to local NUA's on which they will receive incoming calls. It can also be used to force client sockets to make calls from a specific local NUA.. |
void |
close()
Closes a socket, disconnecting any call. |
void |
connect(java.lang.String remoteAddr)
Connects a client socket to a specified remote NUA using an X.25 SVC. The client socket can be bound to a local NUA. If the socket is already be connected or has been closed an Exception will be thrown.. |
void |
connect(java.lang.String remoteAddr,
int timeout)
Connects a client socket with an optional timeout value, which may be 0 if no timeout is required. Note that there is no guarantee that all driver implementations will support timeouts, in which case this call and X25Socket.connect(String) are synonymous.. |
void |
connectPVC(java.lang.String pvcQualifier)
Connects a client socket to a PVC (permanent virtual circuit) X.25 connection. Note that although the "connect" metaphor is used here, in fact PVC's are permanent. So the only connection which is actually being made is between the Java application and the local X.25 card's i/o channel for the specific PVC. Note that whilst the format of NUA's for SVC calls follow a standard which is likely to be common to most X.25 driver implementations, the means of specifying a particular PVC to be used may vary across implementations. Typically the format will be some qualifier to the specific LCN (logical channel number) to be used for the connection.. |
byte[] |
getCallUserData()
Gets any User Data which was supplied with an incoming call. |
byte[] |
getClearCodes()
Gets any cause and diagnostic codes supplied when the current call was disconnected. |
byte[] |
getClearUserData()
Gets any User Data which was supplied when the current call was cleared. |
java.lang.String |
getLocalAddress()
Gets the local NUA to which the socket is bound (if any). |
java.lang.String |
getPhysicalAssignment()
Gets any physical assignment properties for the socket. |
byte[] |
getRawFacilities()
Gets any X.25 Facilities supplied with an incoming call. |
int |
getReceiveBufferSize()
Gets the buffer size used by the underlying driver implementation for input on this connection. |
java.lang.String |
getRemoteAddress()
Gets the remote NUA to which the socket is connected (if any). |
boolean |
isBound()
Tests whether the X25Socket is bound |
boolean |
isClosed()
Tests whether the X25Socket is closed, and hence unavailable for any further operations. |
boolean |
isConnected()
Tests whether the X25Socket is connected, and hence available for data transfer. |
void |
listen(int backlog)
Puts a server socket into Listen Mode, ready to accept incoming connections. Note that prior to listening for connections server sockets must have been bound to a local NUA.. |
int |
recv(X25Message msg)
Receive an incoming message on an X.25 socket. |
int |
send(X25Message msg)
Send a message on an X.25 socket. |
void |
setCallUserData(byte[] cud)
Sets the User Data to be included in the next outgoing call. |
void |
setClearCodes(byte[] clr)
Sets the cause and diagnostic codes to be supplied when the current call is disconnected. |
void |
setClearUserData(byte[] cud)
Sets the User Data to be included when the current call is cleared. |
void |
setPhysicalAssignment(java.lang.String param)
Sets the physical assignment properties for the socket.
It is common for servers to have multi-port X.25 cards, each port driving a physically separate X.25 lines. Additionally, some servers may also have multiple X.25 cards installed. Depending on network topology, there may be a need to ensure that certain operations such as |
void |
setRawFacilities(byte[] fac)
Sets the X.25 Facilities to be used with the next outgoing call. |
void |
setReceiveBufferSize(int size)
Sets the buffer size used by the underlying driver implementation for input on this connection. |
void |
shutdown()
Graceful shutdown of the socket. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String FARSITE_DIAG_PROPERTY
System.out
. Set to true
to enable driver diagnostics.
Constructor Detail |
protected X25SocketImpl() throws java.io.IOException
X25FactoryImpl
.
java.io.IOException
- Description of the ExceptionMethod Detail |
public X25Socket accept() throws java.io.IOException
X25Socket
null
. Error cases will be signalled by an appropriate exception being thrown. This method may be called many times for a single server socket e.g. to accept multiple incoming calls for the same NUA.
accept
in interface X25Socket
X25Socket
instance for the incoming call
java.io.IOException
- if an error occurs whilst waiting for a callX25Socket.bind(java.lang.String)
,
X25Socket.listen(int)
public void bind(java.lang.String localAddr) throws java.io.IOException
FarSite driver specifics:
For the FarSync card, all NUA values are strings of up to 16 numeric characters.
bind
in interface X25Socket
localAddr
- local NUA to bind the socket too.
java.io.IOException
- if an error occurs during the bindpublic void close() throws java.io.IOException
X25Socket
close
in interface X25Socket
java.io.IOException
- if an error occurs during the closepublic void connect(java.lang.String remoteAddr) throws java.io.IOException
FarSite driver specifics:
For the FarSync card, all NUA values are strings of up to 16 numeric characters.
connect
in interface X25Socket
remoteAddr
- remote NUA to connect the socket too
java.io.IOException
- if an error occurs during the connectX25Socket.connect(String, int)
public void connect(java.lang.String remoteAddr, int timeout) throws java.io.IOException
X25Socket.connect(String)
are synonymous..
FarSite driver specifics:
For the FarSync card, all NUA values are strings of up to 16 numeric characters.
connect
in interface X25Socket
remoteAddr
- remote NUA to connect the socket tootimeout
- timeout value in milliseconds, or 0 if no timeout is required
java.io.IOException
- if an error occurs during the connectpublic void connectPVC(java.lang.String pvcQualifier) throws java.io.IOException
Note that whilst the format of NUA's for SVC calls follow a standard which is likely to be common to most X.25 driver implementations, the means of specifying a particular PVC to be used may vary across implementations. Typically the format will be some qualifier to the specific LCN (logical channel number) to be used for the connection..
FarSite driver specifics:
At present PVCs are only supported when using the Windows version of the FarSync sockets interface. An IOException
with a failure to connect will be seen under Linux.
For the FarSync card, the PVC qualifier should be a numeric string containing the LCN to be used for a PVC, prefixed by a '+' character e.g. "+1" would indicate the PVC should use LCN 1. A phsyical assigment must also have been set for the socket or an exception will be thrown.
connectPVC
in interface X25Socket
pvcQualifier
- qualifier for the PVC (e.g. LCN number)
java.io.IOException
- if an error occurs connecting to the PVCsetPhysicalAssignment(java.lang.String)
public byte[] getCallUserData() throws java.io.IOException
X25Socket
getCallUserData
in interface X25Socket
java.io.IOException
- if an error occurs getting the call user dataX25Socket.accept()
public byte[] getClearCodes() throws java.io.IOException
X25Socket
getClearCodes
in interface X25Socket
java.io.IOException
- if an error occurs getting the clear codespublic byte[] getClearUserData() throws java.io.IOException
X25Socket
getClearUserData
in interface X25Socket
java.io.IOException
- if an error occurs getting the clear user datapublic java.lang.String getLocalAddress()
X25Socket
getLocalAddress
in interface X25Socket
public java.lang.String getPhysicalAssignment() throws java.io.IOException
X25Socket
getPhysicalAssignment
in interface X25Socket
java.io.IOException
- if an error occurs getting the physical assignment detailssetPhysicalAssignment(java.lang.String)
public byte[] getRawFacilities() throws java.io.IOException
X25Socket
getRawFacilities
in interface X25Socket
java.io.IOException
- if an error occurs getting the raw facilitiesX25Socket.accept()
public int getReceiveBufferSize() throws java.io.IOException
X25Socket
getReceiveBufferSize
in interface X25Socket
X25Socket
java.io.IOException
- if an error occurs getting the sizeX25Socket.setReceiveBufferSize(int)
public java.lang.String getRemoteAddress()
X25Socket
getRemoteAddress
in interface X25Socket
public boolean isBound()
X25Socket
isBound
in interface X25Socket
X25Socket.bind(java.lang.String)
public boolean isClosed()
X25Socket
isClosed
in interface X25Socket
X25Socket.close()
public boolean isConnected()
X25Socket
isConnected
in interface X25Socket
X25Socket.connect(java.lang.String)
public void listen(int backlog) throws java.io.IOException
FarSite driver specifics:
The FarSync card supports a maximum backlog value of 3.
listen
in interface X25Socket
backlog
- number of incoming connections that can be queued pending an accept operation (may not be supported by all driver implementations)
java.io.IOException
- if an error occurs during the listenX25Socket.bind(java.lang.String)
,
X25Socket.accept()
public int recv(X25Message msg) throws java.io.IOException
X25Socket
It should be note that X25 connections are packet based, hence the operation of this call is subtly different to stream based protocols such as TCP/IP. Firstly, if the buffer within the X25Message
is large enough to receive a complete message, then it can be relied upon that whole messages will be received which are neither segmented nor chained with data from other messages. If the incoming message is too large to fit in the supplied X25Message
, then as much data as will fit in the buffer will be returned, and the M-Bit will be set to indicate there is more data to be received to complete the incoming message. Further recv
calls should be posted until a final X25Message
is received with the M-bit unset.
Additionally, the presence of a Q-bit message can also be determined from the returned X25Message object.
recv
in interface X25Socket
msg
- message object in which to receive incoming data
java.io.IOException
- if an error occurs whilst receiving dataX25Socket.getReceiveBufferSize()
,
X25Socket.setReceiveBufferSize(int)
public int send(X25Message msg) throws java.io.IOException
X25Socket
The X25Message
object can specify whether the data is sent with one or both of the Q-bit and the M-bit set. Message sent with the M-bit set may be buffered by the driver implementation or the network until either full packets of data are available to send, or until a final non M-bit X25Message
has been sent.
send
in interface X25Socket
msg
- message object containing the data to be sent
java.io.IOException
- if an error occurs whilst sending the dataX25Socket.recv(com.ascert.comms.x25.X25Message)
public void setCallUserData(byte[] cud) throws java.io.IOException
X25Socket
setCallUserData
in interface X25Socket
cud
- the user data to be sent with the next call
java.io.IOException
- if an error occurs setting the call user dataX25Socket.connect(java.lang.String)
public void setClearCodes(byte[] clr) throws java.io.IOException
X25Socket
IOException
is thrown.
setClearCodes
in interface X25Socket
clr
- 2 byte array, byte[0] being the cause and byte[1] being the diagnostic data
java.io.IOException
- if an error occurs setting the clear codesX25Socket.close()
public void setClearUserData(byte[] cud) throws java.io.IOException
X25Socket
setClearUserData
in interface X25Socket
cud
- the user data to be sent when the call is cleared
java.io.IOException
- if an error occurs setting the clear user dataX25Socket.close()
public void setPhysicalAssignment(java.lang.String param) throws java.io.IOException
It is common for servers to have multi-port X.25 cards, each port driving a physically separate X.25 lines. Additionally, some servers may also have multiple X.25 cards installed. Depending on network topology, there may be a need to ensure that certain operations such as X25Socket.bind(java.lang.String)
, X25Socket.accept()
, X25Socket.connect(java.lang.String)
are directed to only a single line e.g. where an NUA is only valid for a single physical link. This method allows a socket to be tied to a specific physical line. Note, however, that at present the format used for the physical assignment specifier is driver implementation specific..
FarSite driver specifics:
For the FarSync card, the physical assignment is a string in the format 'adaptor:line' e.g. an assignment value of "0:1" would tie the socket to adapter 0, line 1.
setPhysicalAssignment
in interface X25Socket
param
- driver implementation specific details of the physical line to which all operations for this socket should be directed
java.io.IOException
- if an error occurs setting the physical assignmentpublic void setRawFacilities(byte[] fac) throws java.io.IOException
X25Socket
setRawFacilities
in interface X25Socket
fac
- raw facilities to be included in outgoing call
java.io.IOException
- if an error occurs setting the raw facilitiesX25Socket.connect(java.lang.String)
public void setReceiveBufferSize(int size) throws java.io.IOException
X25Socket
The receive buffer size can affect the ability of the X.25 driver implementation to assemble incoming packets with the M-bit set into whole messages. Setting this value too small will result in lot's of message fragments being received by the application, and more message re-assembly needing to be handled in the application code.
Whatever value is used for the receive buffer size, applications must always ensure they supply a buffer of at least this size in X25Socket.recv(com.ascert.comms.x25.X25Message)
calls to avoid an IllegalArgumentException
being thrown.
setReceiveBufferSize
in interface X25Socket
size
- the new size for the input buffer. The value must be greater than 0.
java.io.IOException
- if an error occurs setting the raw facilitiesX25Socket.getReceiveBufferSize()
,
X25Socket.recv(com.ascert.comms.x25.X25Message)
public void shutdown() throws java.io.IOException
X25Socket
X25Socket.close()
as being synonymous. Where possible though, shutdown should ensure that sockets are closed in a manner which cleans up outstanding i/o requests in low level drivers.
shutdown
in interface X25Socket
java.io.IOException
- if an error occurs during the shutdownX25Socket.close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |