while(!(pSocket->Connect(strIP,nPort))) { if(AfxMessageBox(IDS_CONNECTFAILED,MB_YESNO)==IDNO) { delete pSocket; pSocket=NULL; return ; } }
[quote=引用 10 楼 hybb252190352 的回复:] [quote=引用 9 楼 VisualEleven 的回复:] while(!(pSocket->Connect(strIP,nPort))) 如果connect失败,你这里相当于死循环了。 你的代码是放在主线程中的吧~
[quote=引用 9 楼 VisualEleven 的回复:] while(!(pSocket->Connect(strIP,nPort))) 如果connect失败,你这里相当于死循环了。 你的代码是放在主线程中的吧~
while(!(pSocket->Connect(strIP,nPort))) 如果connect失败,你这里相当于死循环了。 你的代码是放在主线程中的吧~
服务端,没有开启,你连接肯定出错。 Nonzero if the function is successful; otherwise 0, and a specific error code can be retrieved by calling GetLastError. 调用GetLastError看看错误
你服务器都没开启,客户端能connect成功,那才是真的灵异事件了~
服务端没开启,肯定connect失败
18,356
社区成员
64,214
社区内容
加载中
试试用AI创作助手写篇文章吧