我connect一个地址,总是不能成功,以前可以的,大家认为是什么原因啊?
解决方案 »
- Ribbon界面菜单字体大小修改
- 如何给CRichEditCtrl中一段文字设置背景色
- vc ado 连接 access ,open close 速度,这样的数据是否可以?
- 怎么判断知道一个程序 在一天内是第一次运行啊
- VC入门问题?
- 请教一下:VC6.0中的windows Sockets Component如何使用?
- 如何实现DWG文件的输入、输出
- 菜鸟问高手:WNDPROC 有何用?怎么解释它的作用?
- MFC Debug Assertion Failed!
- 不好意思!又来麻烦大家了!我已经禁止鼠标拖动窗口,但是它又带来了新的问题!它把鼠标的按下动作都屏蔽了!这下连菜单都响应不了了!求教!
- 如何动态配置数据源?(急,在线等)
- 请问mfc中有没有这样的消息函数?
Return Value
Nonzero if the function is successful; otherwise 0, and a specific error code can be retrieved by calling GetLastError. If this indicates an error code of WSAEWOULDBLOCK, and your application is using the overridable callbacks, your application will receive an OnConnect message when the connect operation is complete. The following errors apply to this member function: WSANOTINITIALISED A successful AfxSocketInit must occur before using this API.
WSAENETDOWN The Windows Sockets implementation detected that the network subsystem failed.
WSAEADDRINUSE The specified address is already in use.
WSAEINPROGRESS A blocking Windows Sockets call is in progress.
WSAEADDRNOTAVAIL The specified address is not available from the local machine.
WSAEAFNOSUPPORT Addresses in the specified family cannot be used with this socket.
WSAECONNREFUSED The attempt to connect was rejected.
WSAEDESTADDRREQ A destination address is required.
WSAEFAULT The nSockAddrLen argument is incorrect.
WSAEINVAL Invalid host address.
WSAEISCONN The socket is already connected.
WSAEMFILE No more file descriptors are available.
WSAENETUNREACH The network cannot be reached from this host at this time.
WSAENOBUFS No buffer space is available. The socket cannot be connected.
WSAENOTSOCK The descriptor is not a socket.
WSAETIMEDOUT Attempt to connect timed out without establishing a connection.
WSAEWOULDBLOCK The socket is ed as nonblocking and the connection cannot be completed immediately.
Res
If the socket is unbound, unique values are assigned to the local association by the system, and the socket is ed as bound. Note that if the address field of the name structure is all zeroes, Connect will return zero. To get extended error information, call the GetLastError member function.For stream sockets (type SOCK_STREAM), an active connection is initiated to the foreign host. When the socket call completes successfully, the socket is ready to send/receive data. For a datagram socket (type SOCK_DGRAM), a default destination is set, which will be used on subsequent Send and Receive calls.
1.ping 指定IP地址
格式如下:>ping xx.xx.xx.xx
如果不通,不是我们程序员的问题了。
2.tracert 查看数据包路由
格式如下:>tracert xx.xx.xx.xx
查看数据包的流向,很有用的。
3.superscan扫描端口
通过工具软件查看,是否是因为端口被禁用造成的。
4.在对方通过工具监听,看看数据包是否送到。
5.这才轮到程序员出马
通过跟踪来查看变量状态及出错信息。经过这么一番折腾,一般都能解决。
如果不行,给我发邮件,我们接着练!
[email protected]