ebusd_send added.

TCPListener renamed to TCPServer.
TCPClient added.
This commit is contained in:
Roland Jax
2014-06-02 18:58:19 +02:00
parent 9e6ba69f70
commit bc7b4d91b0
8 changed files with 149 additions and 22 deletions
+16 -5
View File
@@ -29,7 +29,8 @@ class TCPSocket
{
public:
friend class TCPListener;
friend class TCPClient;
friend class TCPServer;
~TCPSocket() { close(m_sfd); }
@@ -47,18 +48,28 @@ private:
int m_port;
std::string m_ip;
TCPSocket(int sd, struct sockaddr_in* address);
TCPSocket(int sfd, struct sockaddr_in* address);
};
class TCPListener
class TCPClient
{
public:
TCPListener(int port, std::string address)
TCPSocket* connect(const std::string& server, const int& port);
private:
};
class TCPServer
{
public:
TCPServer(const int port, const std::string address)
: m_lfd(0), m_port(port), m_address(address), m_listening(false) {}
~TCPListener() { if (m_lfd > 0) {close(m_lfd);} }
~TCPServer() { if (m_lfd > 0) {close(m_lfd);} }
int start();
TCPSocket* newSocket();