20 #include "socket_tcp_listen.h" 23 listener_thread_name(
const std::string &thread_name) {
24 if (!thread_name.empty()) {
27 return "ListenerThread";
35 const std::string &thread_name) :
44 void ConnectionListener::
47 <<
"ConnectionListener::receive_datagram called.\n";
54 bool ConnectionListener::
55 process_incoming_data(SocketInfo *sinfo) {
57 DCAST_INTO_R(socket, sinfo->get_socket(),
false);
62 bool got_connection = socket->GetIncomingConnection(*session, addr);
63 #if defined(HAVE_THREADS) && defined(SIMPLE_THREADS) 64 while (!got_connection && socket->
GetLastError() == LOCAL_BLOCKING_ERROR) {
66 got_connection = socket->GetIncomingConnection(*session, addr);
68 #endif // SIMPLE_THREADS 70 if (!got_connection) {
72 <<
"Error when accepting new connection.\n";
80 <<
"Received TCP connection from client " << net_addr
81 <<
" on port " << sinfo->_connection->get_address().get_port()
85 if (_manager !=
nullptr) {
86 _manager->new_connection(new_connection);
88 connection_opened(sinfo->_connection, net_addr, new_connection);
Base functionality for a TCP connected socket This class is pretty useless by itself but it does hide...
A specific kind of Datagram, especially for sending across or receiving from a network.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The primary interface to the low-level networking layer in this package.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void force_yield()
Suspends the current thread for the rest of the current epoch.
This is an abstract base class for a family of classes that listen for activity on a socket and respo...
Base functionality for a TCP rendezvous socket.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A simple place to store and manipulate tcp and port address for communication layer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static int GetLastError()
Gets the last errcode from a socket operation.
Represents a single TCP or UDP socket for input or output.
Represents a network address to which UDP packets may be sent or to which a TCP socket may be bound.