假设不能够判断的话,我的阻塞模式的服务器就要不断的发送东西或者客户端一直处在没有返回值的Recv里面,程序就失控了。救救我~~
解决方案 »
- 我只是一个想学C/C++的小伙。。求灯塔指引
- BCG Taskpane如何得到当前激活的Group
- 超麻烦时间类型处理函数
- 在vc编译环境下如何执行命令行啊?
- 怎么取到窗口的句柄?
- 新人来报到,大家好,先问个MFC编译的问题,谢谢!
- 请教一个在VC中控制excel的问题
- 请问,北京那里可以买到windows95 程序设计(programming windows95)?
- VC下,怎么发HTTP的POST请求,万分焦急,在线等待,服务端是用jsp写的
- 请问 Dao 如何执行 Update 语句?
- 是否有办法禁止ie通过拨号上网?也就是说让ie只能通过局域网上网。
- 关于ActiveX控件在线更新,很难的问题哦!
virtual void OnClose( int nErrorCode );ParametersnErrorCodeThe most recent error on a socket. The following error codes apply to the OnClose member function: 0 The function executed successfully.
WSAENETDOWN The Windows Sockets implementation detected that the network subsystem failed.
WSAECONNRESET The connection was reset by the remote side.
WSAECONNABORTED The connection was aborted due to timeout or other failure.
ResCalled by the framework to notify this socket that the connected socket is closed by its process. For more information, see the articleWindows Sockets: Socket Notifications in Visual C++ Programmer's Guide.
我是这样的
CSocket G02_sockSrvr;
G02_sockSrvr.Create(Port);
G02_sockSrvr.Listen();
这种简单的模式
{
if(nErrorCode != 0) //断开了
{
}
}如果断开了,系统会自动调用
CMySocket::OnClose( int nErrorCode )函数的
int Port=1080;int test()
{
G02_sockSrvr.Create(Port);
G02_sockSrvr.Listen();
AfxMessageBox("ok");
G02_sockSrvr.close();
}virtual void CMySocket::OnClose( int nErrorCode )
{
if(nErrorCode != 0) //断开了
{
AfxMessageBox("ok");
}
}
SOCKET s,HWND hWnd,usigned int wMsg,long lEvent);
它允许用在特定的事件发生时批定一个用户应用程序的WINDOWS消息,
如
WAAsyncSelect(your socket,hWnd,WM_USER+n,FD_READ|FD_CLOSE)
you try!!!!!
我是搞定了,