----------------------------------
DWORD dwBytesReturned=0;
BOOL bNewBehavior=FALSE;
DWORD status;
status = WSAIoctl(PrimaryUDP, SIO_UDP_CONNRESET,
&bNewBehavior, sizeof(bNewBehavior),
NULL, 0, &dwBytesReturned,
NULL, NULL);
if (SOCKET_ERROR == status)
{
DWORD dwErr = WSAGetLastError();
if (WSAEWOULDBLOCK == dwErr)
{
// nothing to do
return(FALSE);
}
else
{
printf("WSAIoctl(SIO_UDP_CONNRESET) Error: %d\\n", dwErr);
return(FALSE);
}
}
----------------------------------
问题:因为本人是ACE新手,所以对于WSAIoctl函数的第1个参数不知如何填写,因为不知道如何找出ACE_SOCK_Stream内部的socket。原大虾们帮忙看看。
附使用代码:
----------------------------------
ACE_SOCK_Stream *pSock = new ACE_SOCK_Stream();
DWORD dwBytesReturned=0;
BOOL bNewBehavior=FALSE;
DWORD status;
status = WSAIoctl( pSock->get_handle()
, SIO_UDP_CONNRESET,
&bNewBehavior, sizeof(bNewBehavior),
NULL, 0, &dwBytesReturned,
NULL, NULL);
if (SOCKET_ERROR == status)
{
DWORD dwErr = WSAGetLastError();
if (WSAEWOULDBLOCK == dwErr)
{
// nothing to do
return NULL;
}
else
{
printf("WSAIoctl(SIO_UDP_CONNRESET) Error: %d\\n", dwErr);
return NULL;
}
}
if(!ConnSrv(pSock,_ipAddr,_port))
{
delete pSock;
pSock=NULL;
_validateSign = false;
delete[] recvbuf;
recvbuf = NULL;
LC_PubFunValue::setSysState(4, "1");
_cErrorCode = "APP0027";
response->setRetCode("APP0027");
return response;
}
----------------------------------
9 个解决方案
#1
10054应该是阻塞吧,之后通过select中的参数可以判断什么时候可读。这有很多socket例子,你可以看看:
http://download.csdn.net/detail/geoff08zhang/4571358
http://download.csdn.net/detail/geoff08zhang/4571358
#2
WSAECONNRESET (10054)
Connection reset by peer.
A existing connection was forcibly closed by the remote host. This normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, or the remote host used a "hard close" (see setsockopt for more information on the SO_LINGER option on the remote socket.)
#3
谢谢你的代码,但是本人想知道如何获取 ACE_SOCK_Stream 中的ACE_SOCKET,因为ACE对它进行了另定义:
typedef ACE_HANDLE ACE_SOCKET;
typedef ACE_HANDLE ACE_SOCKET;
#4
WSAIoctl( 未填
, SIO_UDP_CONNRESET,
&bNewBehavior, sizeof(bNewBehavior),
NULL, 0, &dwBytesReturned,
NULL, NULL);
如何在利用ACE通讯的基础之上填写该函数第1个参数呢
, SIO_UDP_CONNRESET,
&bNewBehavior, sizeof(bNewBehavior),
NULL, 0, &dwBytesReturned,
NULL, NULL);
如何在利用ACE通讯的基础之上填写该函数第1个参数呢
#5
UDP???
#6
TCP
#7
#8
#9
不懂。表示关注。我也一直出现10054错误,不知道如何解决呢。
#1
10054应该是阻塞吧,之后通过select中的参数可以判断什么时候可读。这有很多socket例子,你可以看看:
http://download.csdn.net/detail/geoff08zhang/4571358
http://download.csdn.net/detail/geoff08zhang/4571358
#2
WSAECONNRESET (10054)
Connection reset by peer.
A existing connection was forcibly closed by the remote host. This normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, or the remote host used a "hard close" (see setsockopt for more information on the SO_LINGER option on the remote socket.)
#3
谢谢你的代码,但是本人想知道如何获取 ACE_SOCK_Stream 中的ACE_SOCKET,因为ACE对它进行了另定义:
typedef ACE_HANDLE ACE_SOCKET;
typedef ACE_HANDLE ACE_SOCKET;
#4
WSAIoctl( 未填
, SIO_UDP_CONNRESET,
&bNewBehavior, sizeof(bNewBehavior),
NULL, 0, &dwBytesReturned,
NULL, NULL);
如何在利用ACE通讯的基础之上填写该函数第1个参数呢
, SIO_UDP_CONNRESET,
&bNewBehavior, sizeof(bNewBehavior),
NULL, 0, &dwBytesReturned,
NULL, NULL);
如何在利用ACE通讯的基础之上填写该函数第1个参数呢
#5
UDP???
#6
TCP
#7
#8
#9
不懂。表示关注。我也一直出现10054错误,不知道如何解决呢。