Initial repository 1.0.0
This commit is contained in:
commit
d8b1275884
1861 files changed
+66342
No files matched your search
@@ -0,0 +1,24 @@
|
||||
#include "TCPSocket.h"
|
||||
#include "EPoll.h"
|
||||
#include "Log.h"
|
||||
#include "Exception.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
TCPSocket::TCPSocket(EPoll &ePoll) : Socket(ePoll) {}
|
||||
|
||||
TCPSocket::~TCPSocket() {}
|
||||
|
||||
void TCPSocket::connect(IPAddress &address) {
|
||||
setDescriptor(socket(AF_INET, SOCK_STREAM, 0));
|
||||
if(::connect(getDescriptor(), (struct sockaddr *)&address.address, address.addressLength) == -1)
|
||||
throw Exception("Error on connect to TCP socket.");
|
||||
|
||||
}
|
||||
|
||||
void TCPSocket::output(std::stringstream &out) {
|
||||
out << "|" << ipAddress.getClientAddressAndPort();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user