Меню Закрыть

Disabled use of acceptex winsock2 api

Содержание

When starting Tomcat 6 on Windows 7 Enterprise with JRE 6 using C:Program FilesApache Software FoundationTomcat 6.0in omcat6.exe the application does not open and my event viewer has the message:

"Disabled use of AcceptEx() WinSock2 API."

The same installer of Tomcat worked on Windows Vista before I upgraded my operating system.

Can anyone please suggest a way to fix this?

При запуске Tomcat 6 на Windows 7 Enterprise с JRE 6, используя C:Program FilesApache Software FoundationTomcat 6.0in omcat6.exe приложение не открывается, и у моего наблюдателя событий есть сообщение:

"Отключено использование AcceptEx() API WinSock2.

Тот же установщик Tomcat работал в Windows Vista до того, как я обновил свою операционную систему.

Кто-нибудь может предложить способ исправить это?

Единственный сайт, который я могу найти, это http://www.apachelounge.com/viewtopic.php?p=4418 который предлагает использовать этот конфигурационный параметр "Win32DisableAcceptEx", но для Apache, а не для Tomcat, и я понятия не имею, где в каком конфигурационном файле он может понадобиться в Tomcat.

Отвечено на список рассылки пользователей Tomcat от Caldarale, Charles R:

The AcceptEx function accepts a new connection, returns the local and remote address, and receives the first block of data sent by the client application.

Syntax

Parameters

A descriptor identifying a socket that has already been called with the listen function. A server application waits for attempts to connect on this socket.

A descriptor identifying a socket on which to accept an incoming connection. This socket must not be bound or connected.

A pointer to a buffer that receives the first block of data sent on a new connection, the local address of the server, and the remote address of the client. The receive data is written to the first part of the buffer starting at offset zero, while the addresses are written to the latter part of the buffer. This parameter must be specified.

The number of bytes in lpOutputBuffer that will be used for actual receive data at the beginning of the buffer. This size should not include the size of the local address of the server, nor the remote address of the client; they are appended to the output buffer. If dwReceiveDataLength is zero, accepting the connection will not result in a receive operation. Instead, AcceptEx completes as soon as a connection arrives, without waiting for any data.

Читайте также:  Тонер и картридж отличия

The number of bytes reserved for the local address information. This value must be at least 16 bytes more than the maximum address length for the transport protocol in use.

The number of bytes reserved for the remote address information. This value must be at least 16 bytes more than the maximum address length for the transport protocol in use. Cannot be zero.

A pointer to a DWORD that receives the count of bytes received. This parameter is set only if the operation completes synchronously. If it returns ERROR_IO_PENDING and is completed later, then this DWORD is never set and you must obtain the number of bytes read from the completion notification mechanism.

An OVERLAPPED structure that is used to process the request. This parameter must be specified; it cannot be NULL.

Return Value

If no error occurs, the AcceptEx function completed successfully and a value of TRUE is returned.

If the function fails, AcceptEx returns FALSE. The WSAGetLastError function can then be called to return extended error information. If WSAGetLastError returns ERROR_IO_PENDING, then the operation was successfully initiated and is still in progress. If the error is WSAECONNRESET, an incoming connection was indicated, but was subsequently terminated by the remote peer prior to accepting the call.

Remarks

The AcceptEx function combines several socket functions into a single API/kernel transition. The AcceptEx function, when successful, performs three tasks:

  • A new connection is accepted.
  • Both the local and remote addresses for the connection are returned.
  • The first block of data sent by the remote is received.
Читайте также:  Nikon d3200 съемка видео

A program can make a connection to a socket more quickly using AcceptEx instead of the accept function.

A single output buffer receives the data, the local socket address (the server), and the remote socket address (the client).

Using a single buffer improves performance. When using AcceptEx, the GetAcceptExSockaddrs function must be called to parse the buffer into its three distinct parts (data, local socket address, and remote socket address). On WindowsВ XP and later, once the AcceptEx function completes and the SO_UPDATE_ACCEPT_CONTEXT option is set on the accepted socket, the local address associated with the accepted socket can also be retrieved using the getsockname function. Likewise, the remote address associated with the accepted socket can be retrieved using the getpeername function.

The buffer size for the local and remote address must be 16 bytes more than the size of the sockaddr structure for the transport protocol in use because the addresses are written in an internal format. For example, the size of a sockaddr_in (the address structure for TCP/IP) is 16 bytes. Therefore, a buffer size of at least 32 bytes must be specified for the local and remote addresses.

The AcceptEx function uses overlapped I/O, unlike the accept function. If your application uses AcceptEx, it can service a large number of clients with a relatively small number of threads. As with all overlapped Windows functions, either Windows events or completion ports can be used as a completion notification mechanism.

Another key difference between the AcceptEx function and the accept function is that AcceptEx requires the caller to already have two sockets:

  • One that specifies the socket on which to listen.
  • One that specifies the socket on which to accept the connection.

The sAcceptSocket parameter must be an open socket that is neither bound nor connected.

Читайте также:  Сделать визитку с двух сторон

The lpNumberOfBytesTransferred parameter of the GetQueuedCompletionStatus function or the GetOverlappedResult function indicates the number of bytes received in the request.

When this operation is successfully completed, sAcceptSocket can be passed, but to the following functions only:

When the AcceptEx function returns, the socket sAcceptSocket is in the default state for a connected socket. The socket sAcceptSocket does not inherit the properties of the socket associated with sListenSocket parameter until SO_UPDATE_ACCEPT_CONTEXT is set on the socket. Use the setsockopt function to set the SO_UPDATE_ACCEPT_CONTEXT option, specifying sAcceptSocket as the socket handle and sListenSocket as the option value.

If a receive buffer is provided, the overlapped operation will not complete until a connection is accepted and data is read. Use the getsockopt function with the SO_CONNECT_TIME option to check whether a connection has been accepted. If it has been accepted, you can determine how long the connection has been established. The return value is the number of seconds that the socket has been connected. If the socket is not connected, the getsockopt returns 0xFFFFFFFF. Applications that check whether the overlapped operation has completed, in combination with the SO_CONNECT_TIME option, can determine that a connection has been accepted but no data has been received. Scrutinizing a connection in this manner enables an application to determine whether connections that have been established for a while have received no data. It is recommended such connections be terminated by closing the accepted socket, which forces the AcceptEx function call to complete with an error.

WindowsВ PhoneВ 8: This function is supported for Windows Phone Store apps on WindowsВ PhoneВ 8 and later.

WindowsВ 8.1 and Windows ServerВ 2012В R2: This function is supported for Windows Store apps on WindowsВ 8.1, Windows ServerВ 2012В R2, and later.

Рекомендуем к прочтению

Добавить комментарий

Ваш адрес email не будет опубликован.