Create TCPSession2 for outpubound connections.
This commit is contained in:
1 parent
5c87225c6f
commit
fd70c79282
129 files changed
+1902
-710
No files matched your search
+3
-1
@@ -2,6 +2,7 @@
|
||||
#include "EPoll.h"
|
||||
#include "Log.h"
|
||||
#include "Exception.h"
|
||||
#include "errno.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
@@ -14,7 +15,8 @@ namespace core {
|
||||
void TCPSocket::connect(IPAddress &address) {
|
||||
setDescriptor(socket(AF_INET, SOCK_STREAM, 0));
|
||||
if(::connect(getDescriptor(), (struct sockaddr *)&address.addr, address.addressLength) == -1)
|
||||
throw coreutils::Exception("Error on connect to TCP socket.");
|
||||
throw coreutils::Exception("Error on connect to TCP socket." + errno);
|
||||
coreutils::Log(coreutils::LOG_DEBUG_3) << "Connected to IP..." << address.getClientAddressAndPort();
|
||||
}
|
||||
|
||||
void TCPSocket::output(std::stringstream &out) {
|
||||
|
||||
Reference in new issue
Block a user