29#include <sptk5/net/TCPSocket.h>
30#include <sptk5/threads/Runable.h>
31#include <sptk5/threads/Thread.h>
36#include <netinet/in.h>
76 const String& taskName,
const ServerConnection::Function& connectionFunction = {});
115 void parseAddress(
const sockaddr_in* connectionAddress);
119 if (m_connectionFunction)
121 m_connectionFunction(*
this, socket(), address());
126 mutable std::mutex m_mutex;
132 ServerConnection::Function m_connectionFunction;
138 static size_t nextSerial();
141using SServerConnection = std::shared_ptr<ServerConnection>;
Definition: ServerConnection.h:56
void setSocket(const STCPSocket &socket)
TCPServer & server() const
String address() const
Definition: ServerConnection.h:94
ServerConnection(TCPServer &server, SOCKET connectionSocket, Type type, const sockaddr_in *connectionAddress, const String &taskName, const ServerConnection::Function &connectionFunction={})
void run() override
Definition: ServerConnection.h:117
TCPSocket & socket() const
size_t serial() const
Definition: ServerConnection.h:103
Definition: TCPServer.h:133
Definition: TCPSocket.h:165