🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: cn.bbs.comp.winsock
1 messages
1 total messages Started by ��.���Ǽ��� Tue, 26 Oct 1999 00:00
Re: һ����ֵ�����
#55
Author: ��.���Ǽ���
Date: Tue, 26 Oct 1999 00:00
32 lines
1915 bytes
> ==> Nicky_Sun(��Թ�޻�)                      ˵��: 
>         m_psock=new CClientsock(this); 
>         if(!m_psock->Create()){ 
>                 AfxMessageBox("Client connect server error!"); 
>                 int err=m_psock->GetLastError(); 
>                 char buf[10]; 
>                 gcvt(err,10,buf); 
>                 AfxMessageBox(buf); 
>         } 
>         BOOL ret=m_psock->Connect("202.119.25.233",5050); 
>         if(!ret){ 
>                 AfxMessageBox("Client connect server error!"); 
>                 int err=GetLastError(); 

          GetLastError() returns last Win32 API's error code,
     so you should immediately call it before another Win32 API
     is called.But here you called AfxMessageBox() and it internally
     call Win32 API:MessageBox(),so the error code you got was the
     result of AfxMessageBox(),not Connect().2nd point,I think you 
     should call WSAGetLastError() since winsock recommend it.3rd
     point,even the zero value of Connect()'s return code doesn't
     mean that there's no data sent.It may also mean that the 
     operation is blocked now but will be sent anyway(and you will
     get WSAEWOULDBLOCK as the error code).       
   
> ��ֵ�����ȻConnect(....)�д��󣬵������͸�Server����Ϣ 
> server�����յ�����˭֪������ʲôԭ���� 
> лл�ˣ� 
 

--
�� ��Դ: �й�ƴ�BBSվ [bbs.ustc.edu.cn]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads