太怪了!!!???

microbao1003 2002-12-19 06:01:11
//**.h
CMySocket mDatSocket //CMySocket继承CAsyncSocket

//**.CPP
if(mDatSocket.m_hSocket == INVALID_SOCKET)
mDatSocket.Create(0,SOCK_DGRAM);
if(mDatSocket.Connect(_T("192.168.0.35"),655354) == false)
....

以上代码只要Connect函数中的第一个参数,即IP地址存在就返回TRUE,而不管第二个参数即端口号是否存在。比如改成mDatSocket.Connect(_T("www.sohu.com"),655354),函数也返回TRUE,为什么????
...全文
84 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
HongHuer 2002-12-20
  • 打赏
  • 举报
回复
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.

a default destination //有默认的目的地,
microbao1003 2002-12-20
  • 打赏
  • 举报
回复
up
microbao1003 2002-12-20
  • 打赏
  • 举报
回复
能不能说清楚点啊?
HongHuer 2002-12-20
  • 打赏
  • 举报
回复
数据报 和 流 是有区别的

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧