292
Platforms
©2000-2008 Tibbo Technology Inc.
timeout is a useful way to exit "hanged" connections (this happens a lot with TCP
on large networks).
R/O property informs your application of the time passed
since the data was last exchanged across the connection. Each time there is some
data sent or received the sock.toutcounter is reset to zero. The property
increments at 0.5 second intervals while no data is moving through this socket.
If the sock.connectiontout is not at 0, the sock.toutcounter increments until it
reaches the value of the sock.connectiontout and the connection is terminated. The
sock.toutcounter then stays at the value of sock.connectiontout.
If the sock.connectiontout is at 0, the maximum value that the sock.toutcounter
can reach is 1. That is, the sock.toutcounter will be at 0 after the data exchange,
and at 1 if at least 0.5 seconds have passed since the last data exchange.
Normally, HTTP connections close automatically
There is one case where your socket will perform an active graceful disconnect
without you using the sock.close method. This is the case when the socket is
running in the TCP-HTTP mode.
Accepting Incoming Connections
we have already explained that the socket
automatically switches into the HTTP mode if a TCP connection is accepted on one
of the ports from the
list. The socket can also be switched into
the HTTP mode programmatically, through the
property.
Default HTTP functionality requires that the TCP connection is closed once the
HTTP server has finished sending out its "response" (i.e. HTML page or another file
that has been requested). In this situation the socket won't need the sock.close
from your program- the connection will be terminated automatically. In fact, when
the socket is in the HTTP mode, your
,
, and
will simply be ignored. There is a
property alters the
standard socket behavior in the HTTP mode. Set this property to 1- YES and the
connection will be kept opened even after the socket has sent all of the HTTP reply
out.
Just like in all other cases, a new connection on the socket won't be accepted until
your program has had a chance to respond- this was explained above.
Checking Connection Status
Simplified and detailed socket states
The sock object features several properties that provide complete information on
what the socket is doing, which IP and port it is engaged in the connection with,
etc.
The most important of all this data is the socket state. Two state groups are
supported- "simplified" and "detailed". Simplified state tells you, generally, what
condition the socket is in. Detailed state additionally tells you how this condition
came to be.
For example, the "simplified" PL_SSTS_CLOSED state means that connection is
closed (socket is idle). It doesn't tell you, however, why it is closed. "Detailed"
state PL_SST_CL_ARESET_CMD tells you that connection is closed because there
was an active close as a result of the
method invocation from your
program!
On_sock_event and sock.event, sock.eventsimple read-only properties
360
279
335
334
328
348
331
335
328