FINCLOSE and NOFINCLOSE (JANUS DEFINE parameters): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
(No difference)

Revision as of 23:02, 6 December 2011

<section begin="desc" />Sockets close-connection characteristics<section end="desc" />

FINCLOSE is a parameter on JANUS DEFINE, which defines and sets characteristics of a Janus port. See the List of JANUS DEFINE parameters.

This parameter affects how Janus Sockets applications respond to a closed connection. If the remote host closes the connection, even if it does so "cleanly" (that is with FIN rather than RESET), Janus Sockets closes the connection immediately. This is useful in situations where FIN is as good as RESET for rendering a connection unusable, and where it's important to know that a FIN has been sent to avoid wasted processing or even a hung connection.

If FINCLOSE is not specified, or if NOFINCLOSE is specified, a Janus Sockets thread remains in-use and does not recognize a FIN indicator sent by a remote partner until the Janus Sockets application tries to receive data on the connection.

A situation where FINCLOSE processing is useful is a Janus Sockets application communicating with a web server that is using a keep-alive facility (multiple requests over the same TCP/IP connection). The web server could close the connection between any pair of requests with a FIN. Without FINCLOSE processing, a Janus thread that connected to the web server and received such a FIN would remain in use until the Janus Sockets application tried to receive data on the connection and then noticed the closed connection.

If not set on the port definition, you can make FINCLOSE or NOFINCLOSE specific to a $SOCK_CONN call or to a Socket object New constructor.

FINCLOSE and NOFINCLOSE are available as of Sirius Mods Version 6.4 (originally in a 6.3 ZAP).

The FINCLOSE and NOFINCLOSE parameters are valid only for CLSOCK and SRVSOCK ports.

References

See: List of Janus commands | List of JANUS DEFINE parameters.