1 #ifndef __SOCKET_TCP_LISTEN_H__ 2 #define __SOCKET_TCP_LISTEN_H__ 6 #include "socket_tcp.h" 16 inline bool OpenForListen(
unsigned short port,
int backlog_size = 1024);
17 inline bool OpenForListen(
const Socket_Address &address,
int backlog_size = 1024);
21 inline bool GetIncomingConnection(SOCKET &newsession,
Socket_Address &address);
27 static void init_type() {
28 Socket_IP::init_type();
30 Socket_IP::get_class_type());
33 return get_class_type();
35 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
52 _socket = DO_NEWTCP(AF_INET6);
56 _socket = DO_NEWTCP(AF_INET);
61 if (DO_BIND(_socket, &address.GetAddressInfo()) != 0) {
65 if (DO_LISTEN(_socket, backlog_size) != 0) {
83 if (DO_BIND(_socket, &address.GetAddressInfo()) != 0) {
87 if (DO_LISTEN(_socket, backlog_size) != 0) {
97 inline bool Socket_TCP_Listen::
99 newsession = DO_ACCEPT(_socket, &address.GetAddressInfo());
100 if (newsession == BAD_SOCKET) {
106 inline bool Socket_TCP_Listen::
109 if (!GetIncomingConnection(sck, address)) {
117 #endif //__SOCKET_TCP_LISTEN_H__ Base functionality for a TCP connected socket This class is pretty useless by itself but it does hide...
Base functionality for a INET domain Socket This call should be the starting point for all other unix...
bool set_any_IP(unsigned short port)
Set to any address and a specified port.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool SetV6Only(bool flag)
Sets a flag indicating whether this IPv6 socket should operate in dual-stack mode or not.
Base functionality for a TCP rendezvous socket.
void SetSocket(SOCKET ins)
Assigns an existing socket to this class.
bool set_any_IPv6(unsigned short port)
Set to any IPv6 address and a specified port.
sa_family_t get_family() const
Returns AF_INET if this is an IPv4 address, or AF_INET6 if this is an IPv6 address.
A simple place to store and manipulate tcp and port address for communication layer.
bool SetReuseAddress(bool flag=true)
Informs a socket to reuse IP address as needed.
TypeHandle is the identifier used to differentiate C++ class types.
bool OpenForListen(unsigned short port, int backlog_size=1024)
This function will initialize a listening Socket.