資源簡介
c++實現的Socket客戶端建立程序,WSADATA wsd;
if(WSAStartup(MAKEWORD(2,2),&wsd))
{
MessageBox("WSAStartup_error",NULL,0);
}
int ini=0;
SOCKET s;
s=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (INVALID_SOCKET==s)
{
ini=WSAGetLastError();
MessageBox("ini_socket_error",NULL,0);
}
if(WSAStartup(MAKEWORD(2,2),&wsd))
{
MessageBox("WSAStartup_error",NULL,0);
}
int ini=0;
SOCKET s;
s=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (INVALID_SOCKET==s)
{
ini=WSAGetLastError();
MessageBox("ini_socket_error",NULL,0);
}
代碼片段和文件信息
//?socket_ser.cpp?:?Defines?the?class?behaviors?for?the?application.
//
#include?“stdafx.h“
#include?“socket_ser.h“
#include?“socket_serDlg.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CSocket_serApp
BEGIN_MESSAGE_MAP(CSocket_serApp?CWinApp)
//{{AFX_MSG_MAP(CSocket_serApp)
//?NOTE?-?the?ClassWizard?will?add?and?remove?mapping?macros?here.
//????DO?NOT?EDIT?what?you?see?in?these?blocks?of?generated?code!
//}}AFX_MSG
ON_COMMAND(ID_HELP?CWinApp::onhelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CSocket_serApp?construction
CSocket_serApp::CSocket_serApp()
{
//?TODO:?add?construction?code?here
//?Place?all?significant?initialization?in?InitInstance
}
/////////////////////////////////////////////////////////////////////////////
//?The?one?and?only?CSocket_serApp?object
CSocket_serApp?theApp;
/////////////////////////////////////////////////////////////////////////////
//?CSocket_serApp?initialization
BOOL?CSocket_serApp::InitInstance()
{
AfxEnableControlContainer();
//?Standard?initialization
//?If?you?are?not?using?these?features?and?wish?to?reduce?the?size
//??of?your?final?executable?you?should?remove?from?the?following
//??the?specific?initialization?routines?you?do?not?need.
#ifdef?_AFXDLL
Enable3dControls(); //?Call?this?when?using?MFC?in?a?shared?DLL
#else
Enable3dControlsStatic(); //?Call?this?when?linking?to?MFC?statically
#endif
CSocket_serDlg?dlg;
m_pMainWnd?=?&dlg;
int?nResponse?=?dlg.DoModal();
if?(nResponse?==?IDOK)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?OK
}
else?if?(nResponse?==?IDCANCEL)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?Cancel
}
//?Since?the?dialog?has?been?closed?return?FALSE?so?that?we?exit?the
//??application?rather?than?start?the?application‘s?message?pump.
return?FALSE;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3651??2008-09-08?14:12??socket_ser\ReadMe.txt
?????文件???????1078??2008-09-08?14:12??socket_ser\res\socket_ser.ico
?????文件????????402??2008-09-08?14:12??socket_ser\res\socket_ser.rc2
????..A.SH.??????3072??2008-09-12?11:30??socket_ser\res\Thumbs.db
?????文件????????780??2008-09-13?18:01??socket_ser\resource.h
?????文件??????35644??2008-09-13?18:01??socket_ser\socket_ser.aps
?????文件???????1245??2008-09-13?18:10??socket_ser\socket_ser.clw
?????文件???????2119??2008-09-08?14:12??socket_ser\socket_ser.cpp
?????文件???????4339??2008-09-12?21:10??socket_ser\socket_ser.dsp
?????文件????????543??2008-09-08?14:12??socket_ser\socket_ser.dsw
?????文件???????1368??2008-09-08?14:12??socket_ser\socket_ser.h
?????文件??????50176??2008-09-13?18:10??socket_ser\socket_ser.ncb
?????文件??????54784??2008-09-13?18:10??socket_ser\socket_ser.opt
?????文件????????934??2008-09-13?18:10??socket_ser\socket_ser.plg
?????文件???????5500??2008-09-13?18:01??socket_ser\socket_ser.rc
?????文件???????6341??2008-09-13?18:10??socket_ser\socket_serDlg.cpp
?????文件???????1409??2008-09-12?19:29??socket_ser\socket_serDlg.h
?????文件????????212??2008-09-08?14:12??socket_ser\StdAfx.cpp
?????文件???????1054??2008-09-08?14:12??socket_ser\StdAfx.h
?????目錄??????????0??2008-09-19?10:57??socket_ser\res
?????目錄??????????0??2008-09-24?19:27??socket_ser
-----------?---------??----------?-----??----
???????????????174651????????????????????21
- 上一篇:PRIM算法,求最小生成樹
- 下一篇:大氣科學常用FORTRAN程序
評論
共有 條評論