diff options
Diffstat (limited to 'win/tclWinSock.c')
-rw-r--r-- | win/tclWinSock.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c index c7df204..2e384ee 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -8,7 +8,7 @@ * 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.81 2010/12/14 17:22:55 rmax Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.82 2011/01/25 22:33:56 nijtmans Exp $ * * ----------------------------------------------------------------------- * @@ -1050,18 +1050,18 @@ CreateSocket( TclWinConvertWSAError((DWORD) WSAGetLastError()); continue; } - + /* * Win-NT has a misfeature that sockets are inherited in child * processes by default. Turn off the inherit bit. */ - + SetHandleInformation((HANDLE) sock, HANDLE_FLAG_INHERIT, 0); - + /* * Set kernel space buffering */ - + TclSockMinimumBuffers((ClientData)sock, TCP_BUFFER_SIZE); /* @@ -1103,34 +1103,34 @@ CreateSocket( chosenport = ntohs(sockname.sa4.sin_port); } } - + /* * Set the maximum number of pending connect requests to the max value * allowed on each platform (Win32 and Win32s may be different, and * there may be differences between TCP/IP stacks). */ - + if (listen(sock, SOMAXCONN) == SOCKET_ERROR) { TclWinConvertWSAError((DWORD) WSAGetLastError()); closesocket(sock); continue; } - + if (infoPtr == NULL) { /* * Add this socket to the global list of sockets. */ - + infoPtr = NewSocketInfo(sock); fds = infoPtr->sockets; - + /* * Set up the select mask for connection request events. */ - + infoPtr->selectEvents = FD_ACCEPT; infoPtr->watchEvents |= FD_ACCEPT; - + } else { newfds = (TcpFdList *) ckalloc((unsigned) sizeof(TcpFdList)); memset(newfds, (int) 0, sizeof(TcpFdList)); @@ -1159,7 +1159,7 @@ CreateSocket( TclWinConvertWSAError((DWORD) WSAGetLastError()); continue; } - + /* * Win-NT has a misfeature that sockets are inherited in child * processes by default. Turn off the inherit bit. @@ -1170,13 +1170,13 @@ CreateSocket( /* * Set kernel space buffering */ - + TclSockMinimumBuffers((ClientData)sock, TCP_BUFFER_SIZE); - + /* * Try to bind to a local port. */ - + if (bind(sock, myaddrPtr->ai_addr, myaddrPtr->ai_addrlen) == SOCKET_ERROR) { TclWinConvertWSAError((DWORD) WSAGetLastError()); @@ -1197,14 +1197,14 @@ CreateSocket( /* * Attempt to connect to the remote socket. */ - + if (connect(sock, addrPtr->ai_addr, addrPtr->ai_addrlen) == SOCKET_ERROR) { TclWinConvertWSAError((DWORD) WSAGetLastError()); if (Tcl_GetErrno() != EWOULDBLOCK) { goto looperror; } - + /* * The connection is progressing in the background. */ @@ -1227,14 +1227,14 @@ CreateSocket( /* * Add this socket to the global list of sockets. */ - + infoPtr = NewSocketInfo(sock); - + /* * Set up the select mask for read/write events. If the * connect attempt has not completed, include connect events. */ - + infoPtr->selectEvents = FD_READ | FD_WRITE | FD_CLOSE; if (asyncConnect) { infoPtr->flags |= SOCKET_ASYNC_CONNECT; @@ -1252,11 +1252,11 @@ CreateSocket( * Register for interest in events in the select mask. Note that this * automatically places the socket into non-blocking mode. */ - + if (infoPtr != NULL) { ioctlsocket(sock, (long) FIONBIO, &flag); SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, (LPARAM) infoPtr); - + return infoPtr; } @@ -1455,7 +1455,7 @@ Tcl_OpenTcpClient( return NULL; } - wsprintfA(channelName, "sock%d", infoPtr->sockets->fd); + sprintf(channelName, "sock%Id", (size_t) infoPtr->sockets->fd); infoPtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, infoPtr, (TCL_READABLE | TCL_WRITABLE)); @@ -1520,7 +1520,7 @@ Tcl_MakeTcpClientChannel( SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, (LPARAM) infoPtr); - wsprintfA(channelName, "sock%d", infoPtr->sockets->fd); + sprintf(channelName, "sock%Id", (size_t) infoPtr->sockets->fd); infoPtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, infoPtr, (TCL_READABLE | TCL_WRITABLE)); Tcl_SetChannelOption(NULL, infoPtr->channel, "-translation", "auto crlf"); @@ -1573,7 +1573,7 @@ Tcl_OpenTcpServer( infoPtr->acceptProc = acceptProc; infoPtr->acceptProcData = acceptProcData; - wsprintfA(channelName, "sock%d", infoPtr->sockets->fd); + sprintf(channelName, "sock%Id", (size_t) infoPtr->sockets->fd); infoPtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, infoPtr, 0); @@ -1679,7 +1679,7 @@ TcpAccept( SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, (LPARAM) newInfoPtr); - wsprintfA(channelName, "sock%d", newInfoPtr->sockets->fd); + sprintf(channelName, "sock%Id", (size_t) newInfoPtr->sockets->fd); newInfoPtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, newInfoPtr, (TCL_READABLE | TCL_WRITABLE)); if (Tcl_SetChannelOption(NULL, newInfoPtr->channel, "-translation", @@ -2171,7 +2171,7 @@ TcpGetOptionProc( address sockname; socklen_t size; int found = 0; - + if (len == 0) { Tcl_DStringAppendElement(dsPtr, "-sockname"); Tcl_DStringStartSublist(dsPtr); @@ -2182,11 +2182,11 @@ TcpGetOptionProc( if (getsockname(sock, &(sockname.sa), &size) >= 0) { int flags = reverseDNS; found = 1; - + getnameinfo(&sockname.sa, size, host, sizeof(host), NULL, 0, NI_NUMERICHOST); Tcl_DStringAppendElement(dsPtr, host); - + /* * We don't want to resolve INADDR_ANY and sin6addr_any; they * can sometimes cause problems (and never have a name). @@ -2228,7 +2228,7 @@ TcpGetOptionProc( return TCL_ERROR; } } - + #ifdef TCL_FEATURE_KEEPALIVE_NAGLE if (len == 0 || !strncmp(optionName, "-keepalive", len)) { int optlen; |