Introduction
First of all, I am sorry for my bad English. CSyncSocket
is a simple class that has the same members as CAsyncSocket
class, but it can be used in multithreading mode. This class can be used in MFC and Win32 applications. Just include <WINSOCK2.h> and WS2_32.lib in your application and it will work properly.
class CSyncSocket
{
public:
void ShutDown(int HOW);
void Close();
void Accept(CSyncSocket*);
BOOL GetSockOpt(int nOptionName,void* lpOptionValue,
int* lpOptionLen,int nLevel = SOL_SOCKET);
BOOL SetSockOpt(int nOptionName,const void* lpOptionValue,
int nOptionLen,int nLevel = SOL_SOCKET );
bool Bind(UINT Port);
bool Listen(UINT Port);
int Recieve(BYTE*buff, int Length);
bool Send(BYTE* buff, int length);
bool Connect(LPSTR Host, UINT port);
BOOL Create();
CSyncSocket();
void operator = (CSyncSocket& dest);
operator SOCKET();
virtual ~CSyncSocket();
SOCKET m_Socket;
protected:
virtual bool OnAccept(sockaddr*,int*);
bool m_IsBound;
virtual u_long GetCompatibleHost(CString Host);
};