Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: |
|
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | rmax-ipv6-branch |
Files: | files | file ages | folders |
SHA1: |
68deb29eadeaa99871d0482cec38ff9a |
User & Date: | max 2011-06-16 15:21:10 |
Original Comment: |
|
Context
2011-06-22
| ||
14:21 | complete a comment in socket.test Closed-Leaf check-in: 8f2747dc54 user: max tags: rmax-ipv6-branch | |
2011-06-16
| ||
15:21 |
| |
2011-06-07
| ||
14:59 | Simplify file descriptor handling for client sockets and derived server sockets by putting an instan... check-in: 5f816f5758 user: max tags: rmax-ipv6-branch | |
Changes
Changes to doc/socket.n.
︙ | ︙ | |||
67 68 69 70 71 72 73 | port number will be chosen at random by the system software. .TP \fB\-async\fR . This option will cause the client socket to be connected asynchronously. This means that the socket will be created immediately but may not yet be connected to the server, when the call to | > > | | | | | | > > > > > > > > > | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | port number will be chosen at random by the system software. .TP \fB\-async\fR . This option will cause the client socket to be connected asynchronously. This means that the socket will be created immediately but may not yet be connected to the server, when the call to \fBsocket\fR returns. When a \fBgets\fR or \fBflush\fR is done on the socket before the connection attempt succeeds or fails, if the socket is in blocking mode, the 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. Synchronous client sockets may be switched (after they have connected) to operating in asynchronous mode using: .RS .PP .CS \fBchan configure \fIchan \fB\-blocking 0\fR .CE .PP See the \fBchan\fR \fBconfigure\fR command for more details. The Tcl event loop should be running while an asynchronous connection is in progress, because it may have to do several connection attempts in the background. Runnig the event loop also allows you to set up a writable channel event on the socket to get notified when the asyncronous connection has succeeded or failed. See the \fBvwait\fR and the \fBchan\fR comands for more details on the event loop and channel events. .RE .SH "SERVER SOCKETS" .PP If the \fB\-server\fR option is specified then the new socket will be a server that listens on the given \fIport\fR (either an integer or a service name, where supported and understood by the host operating system; if \fIport\fR is zero, the operating system will allocate a |
︙ | ︙ |
Changes to tests/socket.test.
︙ | ︙ | |||
1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 | test socket-14.2 {[socket -async] fileevent connection refused} \ -constraints [list socket supported_any] \ -body { set client [socket -async localhost [randport]] fileevent $client writable {set x [fconfigure $client -error]} set after [after 1000 {set x timeout}] vwait x set x } -cleanup { after cancel $after close $client unset x } -result "connection refused" | > > > | 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 | test socket-14.2 {[socket -async] fileevent connection refused} \ -constraints [list socket supported_any] \ -body { set client [socket -async localhost [randport]] fileevent $client writable {set x [fconfigure $client -error]} set after [after 1000 {set x timeout}] vwait x if {$x eq "timeout"} { append x ": [fconfigure $client -error]" } set x } -cleanup { after cancel $after close $client unset x } -result "connection refused" |
︙ | ︙ |
Changes to unix/tclUnixSock.c.
︙ | ︙ | |||
967 968 969 970 971 972 973 | * will set up a file handler on the socket if she is interested * in being informed when the connect completes. */ status = connect(state->fds.fd, state->addr->ai_addr, state->addr->ai_addrlen); if (status < 0 && errno == EINPROGRESS) { | | > | 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | * will set up a file handler on the socket if she is interested * in being informed when the connect completes. */ status = connect(state->fds.fd, state->addr->ai_addr, state->addr->ai_addrlen); if (status < 0 && errno == EINPROGRESS) { Tcl_CreateFileHandler(state->fds.fd, TCL_WRITABLE | TCL_EXCEPTION, TcpAsyncCallback, state); return TCL_OK; coro_continue: Tcl_DeleteFileHandler(state->fds.fd); /* * Read the error state from the socket, to see if the async |
︙ | ︙ |