diff options
Diffstat (limited to 'doc/socket.n')
-rw-r--r-- | doc/socket.n | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/doc/socket.n b/doc/socket.n index 5fc5874..201fff0 100644 --- a/doc/socket.n +++ b/doc/socket.n @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: socket.n,v 1.11 2004/08/31 15:19:36 dkf Exp $ +'\" RCS: @(#) $Id: socket.n,v 1.12 2004/10/27 14:24:37 dkf Exp $ .so man.macros .TH socket n 8.0 Tcl "Tcl Built-In Commands" .BS @@ -36,7 +36,6 @@ will need to use \fBfconfigure\fR to alter this to something else, such as \fIutf\-8\fR (ideal for communicating with other Tcl processes) or \fIiso8859\-1\fR (useful for many network protocols, especially the older ones). - .SH "CLIENT SOCKETS" .PP If the \fB\-server\fR option is not specified, then the client side of a @@ -78,7 +77,6 @@ operation will wait until the connection is completed or fails. If the socket is in nonblocking mode and a \fBgets\fR or \fBflush\fR is done on the socket before the connection attempt succeeds or fails, the operation returns immediately and \fBfblocked\fR on the socket returns 1. - .SH "SERVER SOCKETS" .PP If the \fB\-server\fR option is specified then the new socket @@ -121,7 +119,6 @@ an unused port for use as a server socket. The port number actually allocated may be retrieved from the created server socket using the \fBfconfigure\fR command to retrieve the \fB\-sockname\fR option as described below. - .SH "CONFIGURATION OPTIONS" The \fBfconfigure\fR command can be used to query several readonly configuration options for socket channels: @@ -145,26 +142,23 @@ address, the host name and the port to which the peer socket is connected or bound. If the host name cannot be computed, the second element of the list is identical to the address, its first element. .PP - .SH "EXAMPLES" Here is a very simple time server: - .CS proc Server {channel clientaddr clientport} { - puts "Connection from $clientaddr registered" - puts $channel [clock format [clock seconds]] - close $channel + puts "Connection from $clientaddr registered" + puts $channel [clock format [clock seconds]] + close $channel } -socket -server Server 9900 +\fBsocket\fR -server Server 9900 vwait forever .CE - +.PP And here is the corresponding client to talk to the server: - .CS set server localhost -set sockChan [socket $server 9900] +set sockChan [\fBsocket\fR $server 9900] gets $sockChan line close $sockChan puts "The time on $server is $line" |