犯了一個低級的錯誤,唉,老了嗎?

想用Csocket類實現網絡通信,但是xtp並沒有提供Socket的初始化,哎,困擾了好幾天,終於在水木上有哥們提醒了一下!汗啊!!

標  題: Can't create socket successfully ? 發信站: 水木社區 (Sun Jun 29 16:27:04 2008), 站內 I am using xtp pro 11, VC6 I want to create a SOCKET on the MDI window ,when the program running ,it reported socket create error !!   In my project, I create a MDI window which is inherited from CXTPMDIFrameWnd, but ,when I wanted created a socket on the child window , although the building is passed , running error displayed !! It was: Can't create socket successfully!The code followed here:     CAsyncSocket*pSocket=new CAsyncSocket; int nPort=27; if (pSocket->Create(nPort,SOCK_DGRAM)) {  AfxMessageBox("passed"); }else { AfxMessageBox("SOCKET_ERROR"); }   Why I can't create socket ?   Created socket in the child window ,the error displayed as the same.

標  題: Re: Can't create socket successfully ? 發信站: 水木社區 (Sun Jun 29 17:15:30 2008), 站內 如果項目中沒有設置winsock支持,就要手動調用AfxSocketInit來初始化

*************************************************************************

好了,解決了!

xtp還是很強大的!!歡迎來和我討論!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章