Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <windows.h>
- //#include <winsock2.h>
- #include <stdlib.h>
- #include <time.h>
- #pragma comment(lib, "Ws2_32.lib")
- class Socket {
- protected:
- WSADATA wsaData;
- SOCKET mainSocket;
- SOCKADDR_IN serverInfo;
- public:
- Socket();
- ~Socket();
- void Start();
- void Stop();
- void HandleError( int , std::string );
- };
- class ServerSocket : public Socket {
- protected:
- SOCKET clientSocket;
- char * sendBuffer;
- void ManageSendBuffer();
- public:
- void Initialize();
- void Bind( int );
- void Listen();
- void AcceptClient();
- void CloseClient();
- void SendChar( const char * , int );
- int RecvChar( char * , int );
- };
- class ClientSocket : public Socket {
- public:
- void Connect();
- void SetServerInfo( std::string , int );
- void SendChar( const char * , int );
- int RecvChar( char * , int );
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement