The iocp::inet
namespace implements communication over TCP/IP. It provides the same interface as the Tcl core socket
command but with greater performance.
The package is loaded as
package require iocp_inet
Returns a client or server TCP/IP channel.
args | See the Tcl core socket command. |
The command provides the same interface as the Tcl core socket command except for the additional socket options listed below. Refer to the documentation of the Tcl socket command for details.
The only functional enhancement offered by this command is significantly improved performance with reduced CPU load.
In addition to the standard configuration options supported by the Tcl socket
command, the following additional configuration options are supported through the Tcl fconfigure
and chan configure
commands. They can be read as well as set.
-keepalive BOOL | Controls the socket SO_KEEPALIVE option. |
-maxpendingaccepts COUNT | Maximum number of pending accepts to post on the socket (listening socket only). |
-maxpendingreads COUNT | Maximum number of pending reads to post on the socket. |
-maxpendingwrites COUNT | Maximum number of pending writes to post on the socket. |
-nagle BOOL | Controls the socket TCL_NODELAY option. |
-sorcvbuf BUFSIZE | Size of Winsock socket receive buffer. |
-sosndbuf BUFSIZE | Size of Winsock socket send buffer. |
It is recommended these be left at their default values except in cases where performance needs to be fine tuned for specific traffic patterns. The netbench
utility may be used for the purpose.
The returned channel must be closed with the Tcl close
or chan close
command.
Returns a client or server TCP/IP channel.
proc ::iocp::inet::socket {args} { # Returns a client or server TCP/IP channel. # args - see the Tcl core `socket` command # # The command provides the same interface as the Tcl core # [socket](http://www.tcl-lang.org/man/tcl8.6/TclCmd/socket.htm) command # except for the additional socket options listed below. Refer to the # documentation of the Tcl # [socket](http://www.tcl-lang.org/man/tcl8.6/TclCmd/socket.htm) # command for details. # # The only functional enhancement offered by this command is # significantly improved performance with reduced CPU load. # # In addition to the standard configuration options supported # by the Tcl `socket` command, the following additional configuration # options are supported through the Tcl `fconfigure` and # `chan configure` commands. They can be read as well as set. # # -keepalive BOOL - Controls the socket `SO_KEEPALIVE` option. # -maxpendingaccepts COUNT - Maximum number of pending accepts to post # on the socket (listening socket only). # -maxpendingreads COUNT - Maximum number of pending reads to post # on the socket. # -maxpendingwrites COUNT - Maximum number of pending writes to post # on the socket. # -nagle BOOL - Controls the socket `TCL_NODELAY` option # -sorcvbuf BUFSIZE - Size of Winsock socket receive buffer. # -sosndbuf BUFSIZE - Size of Winsock socket send buffer. # # It is recommended these be left at their default values except # in cases where performance needs to be fine tuned for specific # traffic patterns. The `netbench` utility may be used for the # purpose. # # The returned channel must be closed with the Tcl `close` # or `chan close` command. }