|
IP*Works! V9 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectipworks.Connection
public class Connection
A currently connected client.
This type describes the connection of a client which is currently connected to the bean. You may use the different fields of this type to manage the connection.
AcceptData:
Setting this field to False, temporarily disables data reception
(and the DataIn
event) on the connection. Setting this to True, re-enables data reception.
BytesSent:
This field shows how many bytes were sent after the last assignment to DataToSend
. Please check the DataToSend
for more information.
Connected: This field is used to disconnect individual connections and/or show their status.
The Connected
field may be set to false to close the connection.
Connected
also shows the status of a particular connection (connected/disconnected).
How and when the connection is closed is controlled by the Linger
property. Please refer to its description for more information.
ConnectionId: This field contains an identifier generated by the bean to identify each connection. This identifier is unique to this connection.
DataToSend: This field contains a string of data to be sent to the remote host. Write-only property.
Assigning a string to the DataToSend
makes the bean send
the string to the remote host. The Send
method provides similar functionality.
When Timeout
is set to 0 the bean will behave asynchronously. If you are sending data to the remote host faster than it can
process it, or faster than the network's bandwidth allows, the outgoing
queue might fill up. When this happens, DataToSend
fails with exception 10035: "[10035] Operation would block" (WSAEWOULDBLOCK).
You can check this error, and then try to send the data again.
The BytesSent
property shows how many bytes were sent
(if any). If 0 bytes were sent, then you
can wait for the ReadyToSend
event before attempting to send data
again. (However, please note that ReadyToSend
is not fired when part
of the data is successfully sent).
EOL:
The EOL
field is used to define boundaries in the input stream using the value of the field.
The EOL
field is especially useful with ASCII files. Setting it to
CRLF ("\\r\\n")
enables splitting of the incoming ASCII text stream into lines. In this case, one event is fired for each line received (as well as in packet boundaries).
The CRLF ("\\r\\n")
. bytes are discarded.
The EOL
field is a binary string. In particular, this means that it can be more than one byte long, and it can contain NULL bytes.
LocalAddress: This field shows the IP address of the interface through which the connection is passing.
LocalAddress
is important for multi-homed hosts where it can be used to find which particular network interface an individual connection is going through.
MaxLineLength:
This field is the size of an internal buffer which holds received data while waiting for an EOL
string.
If an EOL
string is found in the input stream before MaxLineLength
bytes are received, the DataIn
event is fired with the EOL parameter set to True, and the buffer is reset.
If no EOL
is found, and MaxLineLength
bytes are accumulated in the buffer, the DataIn
event is fired with the EOL parameter set to False, and the buffer is reset.
The minimum value for MaxLineLength
is 256 bytes. The default value is 2048 bytes. The maximum value is 65536 bytes.
RemoteHost: This field shows the IP address of the remote host through which the connection is coming.
The connection must be valid or an error will be fired.
If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceded with an "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.
RemotePort: This field shows the TCP port on the remote host through which the connection is coming.
The connection must be valid or an error will be fired.
SingleLineMode:
This field shows the special mode for line-oriented protocols. When SingleLineMode
is True, the bean treats the incoming data stream as lines separated by CRLF, CR, or LF. The EOL
property is ignored.
Timeout: This field contains a timeout for the bean.
If the Timeout
property is set to 0, all operations return
immediately, potentially failing with a 'WOULDBLOCK' error if data can't be sent or received immediately.
If Timeout
is set to a positive value, the bean will automatically retry each operation that would otherwise result in a 'WOULDBLOCK' error for a maximum of Timeout
seconds.
The bean will use DoEvents
to enter an efficient wait loop
during any potential waiting period, making sure that all system events
are processed immediately as they arrive. This ensures that the host
application does not "freeze" and remains responsive.
If Timeout
expires, and the operation is not yet complete,
the bean throws an exception.
Please note that by default, all timeouts are inactivity timeouts ,
i.e. the timeout period is extended by Timeout
seconds when
any amount of data is successfully sent or received.
Optionally, the behavior of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum
of Timeout
seconds since the beginning of the operation, without
extending the timeout period during communications.
This behavior is controlled by the AbsoluteTimeout
configuration setting.
The default value for the Timeout
property is 0 (asynchronous operation).
UploadStream:
Setting this field uploads the data in the specified stream to the current connection. The bean will automatically close this stream if CloseStreamAfterTransfer
is true (default).
Atom
,
Atom.Connection
Constructor Summary | |
---|---|
Connection()
|
Method Summary | |
---|---|
boolean |
getAcceptData()
|
int |
getBytesSent()
|
boolean |
getConnected()
|
java.lang.String |
getConnectionId()
|
byte[] |
getEOL()
|
java.lang.String |
getLocalAddress()
|
int |
getMaxLineLength()
|
java.lang.String |
getRemoteHost()
|
int |
getRemotePort()
|
boolean |
getSingleLineMode()
|
int |
getTimeout()
|
void |
setAcceptData(boolean value)
|
void |
setConnected(boolean value)
|
void |
setDataToSend(byte[] value)
|
void |
setEOL(byte[] value)
|
void |
setMaxLineLength(int value)
|
void |
setSingleLineMode(boolean value)
|
void |
setTimeout(int value)
|
void |
setUploadStream(java.io.InputStream value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Connection()
Method Detail |
---|
public boolean getAcceptData()
public void setAcceptData(boolean value)
public int getBytesSent()
public boolean getConnected()
public void setConnected(boolean value)
public java.lang.String getConnectionId()
public void setDataToSend(byte[] value)
public byte[] getEOL()
public void setEOL(byte[] value)
public java.lang.String getLocalAddress()
public int getMaxLineLength()
public void setMaxLineLength(int value)
public java.lang.String getRemoteHost()
public int getRemotePort()
public boolean getSingleLineMode()
public void setSingleLineMode(boolean value)
public int getTimeout()
public void setTimeout(int value)
public void setUploadStream(java.io.InputStream value)
|
IP*Works! V9 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |