1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
-
+
|
/*
* tclWinSock.c --
*
* This file contains Windows-specific socket related code.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclWinSock.c,v 1.1.2.4 1998/12/12 01:37:06 lfb Exp $
* RCS: @(#) $Id: tclWinSock.c,v 1.1.2.5 1999/02/10 23:31:29 stanton Exp $
*/
#include "tclWinInt.h"
/*
* The following variable is used to tell whether this module has been
* initialized.
|
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
|
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
|
-
+
|
mask |= TCL_READABLE;
} else {
(void) (*winSock.WSAAsyncSelect)(infoPtr->socket, winSock.hwnd,
SOCKET_MESSAGE, infoPtr->selectEvents);
infoPtr->readyEvents &= ~(FD_READ);
}
}
if (events & FD_WRITE) {
if (events & (FD_WRITE | FD_CONNECT)) {
mask |= TCL_WRITABLE;
}
if (mask) {
Tcl_NotifyChannel(infoPtr->channel, mask);
}
return 1;
|
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
|
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
}
infoPtr = (SocketInfo *) instanceData;
sock = (int) infoPtr->socket;
if (optionName != (char *) NULL) {
len = strlen(optionName);
}
if ((len > 1) && (optionName[1] == 'e') &&
(strncmp(optionName, "-error", len) == 0)) {
int optlen;
int err, ret;
optlen = sizeof(int);
ret = TclWinGetSockOpt(sock, SOL_SOCKET, SO_ERROR,
(char *)&err, &optlen);
if (ret == SOCKET_ERROR) {
err = (*winSock.WSAGetLastError)();
}
if (err) {
TclWinConvertWSAError(err);
Tcl_DStringAppend(dsPtr, Tcl_ErrnoMsg(Tcl_GetErrno()), -1);
}
return TCL_OK;
}
if ((len == 0) ||
((len > 1) && (optionName[1] == 'p') &&
(strncmp(optionName, "-peername", len) == 0))) {
if ((*winSock.getpeername)(sock, (struct sockaddr *) &peername, &size)
== 0) {
if (len == 0) {
|
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
|
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
|
-
+
|
*/
infoPtr->watchEvents = 0;
if (mask & TCL_READABLE) {
infoPtr->watchEvents |= (FD_READ|FD_CLOSE|FD_ACCEPT);
}
if (mask & TCL_WRITABLE) {
infoPtr->watchEvents |= (FD_WRITE);
infoPtr->watchEvents |= (FD_WRITE|FD_CONNECT);
}
/*
* If there are any conditions already set, then tell the notifier to poll
* rather than block.
*/
|