//SocketInterface.cpp #include "stdafx.h" #include "SocketInterface.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> CSocketBase <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< CString CSocketBase::UserName; CString CSocketBase::HostName; CString CSocketBase::LocalIP; //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> CSocketServer <<<<<<<<<<<<<<<<<<<<<<<<<<< void CSocketServer::Empty() {while(Sockets) delete Sockets;} void CSocketServer::Broadcast(const CString& Msg) {for(volatile CConnection* it=Sockets; it; it=it->Next) ((CConnection*)it)->Send(Msg);} UINT __cdecl CSocketServer::ThreadProc(LPVOID pParam) { if(!AfxSocketInit()) AfxMessageBox(sNoSockets); //Put here to allow multithreaded use (You won't need it in your Application class) CSocketServer* Me=(CSocketServer*)pParam; CConnection* Socket; Socket=Me->New(); // This is where the new Connection gets created by the User's Handler class. if(Socket->Attach(Me->hSocket)) Socket->Connect(); //Have to do this for Threaded Sockets to work. else delete Socket; return 0; }