ACE 8.0.5
Loading...
Searching...
No Matches
ACE_LOCK_SOCK_Acceptor< ACE_LOCK > Class Template Reference

Specialize ACE_SOCK_Acceptor to lock around <accept>;. More...

#include <LOCK_SOCK_Acceptor.h>

Inheritance diagram for ACE_LOCK_SOCK_Acceptor< ACE_LOCK >:
Collaboration diagram for ACE_LOCK_SOCK_Acceptor< ACE_LOCK >:

Public Member Functions

int accept (ACE_SOCK_Stream &new_stream, ACE_Addr *remote_addr=0, ACE_Time_Value *timeout=0, bool restart=true, bool reset_new_handle=false) const
 Accept the connection under the control of the <ACE_LOCK>.
ACE_LOCK & lock ()
 Return a reference to the lock.
Public Member Functions inherited from ACE_SOCK_Acceptor
 ACE_SOCK_Acceptor ()
 Default constructor.
 ACE_SOCK_Acceptor (const ACE_Addr &local_sap, int reuse_addr=0, int protocol_family=PF_UNSPEC, int backlog=ACE_DEFAULT_BACKLOG, int protocol=0, int ipv6_only=0)
 ACE_SOCK_Acceptor (const ACE_Addr &local_sap, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g, u_long flags, int reuse_addr, int protocol_family=PF_UNSPEC, int backlog=ACE_DEFAULT_BACKLOG, int protocol=0, int ipv6_only=0)
 Initialize a passive-mode QoS-enabled acceptor socket.
int open (const ACE_Addr &local_sap, int reuse_addr=0, int protocol_family=PF_UNSPEC, int backlog=ACE_DEFAULT_BACKLOG, int protocol=0, int ipv6_only=0)
int open (const ACE_Addr &local_sap, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g, u_long flags, int reuse_addr, int protocol_family=PF_UNSPEC, int backlog=ACE_DEFAULT_BACKLOG, int protocol=0, int ipv6_only=0)
int close ()
 Close the socket. Returns 0 on success and -1 on failure.
 ~ACE_SOCK_Acceptor ()
 Default dtor.
int accept (ACE_SOCK_Stream &new_stream, ACE_Addr *remote_addr=0, ACE_Time_Value *timeout=0, bool restart=true, bool reset_new_handle=false) const
int accept (ACE_SOCK_Stream &new_stream, ACE_Accept_QoS_Params qos_params, ACE_Addr *remote_addr=0, ACE_Time_Value *timeout=0, bool restart=true, bool reset_new_handle=false) const
void dump () const
 Dump the state of an object.
Public Member Functions inherited from ACE_SOCK
int set_option (int level, int option, void *optval, int optlen) const
 Wrapper around the setsockopt system call.
int get_option (int level, int option, void *optval, int *optlen) const
 Wrapper around the getsockopt system call.
int close ()
int get_local_addr (ACE_Addr &) const
int get_remote_addr (ACE_Addr &) const
void dump () const
 Dump the state of an object.
int open (int type, int protocol_family, int protocol, int reuse_addr)
 Wrapper around the BSD-style socket system call (no QoS).
int open (int type, int protocol_family, int protocol, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g, u_long flags, int reuse_addr)
 Wrapper around the QoS-enabled WSASocket function.
Public Member Functions inherited from ACE_IPC_SAP
int control (int cmd, void *) const
 Interface for <ioctl>.
int enable (int value) const
int disable (int value) const
ACE_HANDLE get_handle () const
 Get the underlying handle.
void set_handle (ACE_HANDLE handle)
 Set the underlying handle.
void dump () const
 Dump the state of an object.

Protected Attributes

ACE_LOCK lock_
 Type of locking mechanism.

Additional Inherited Members

Public Types inherited from ACE_SOCK_Acceptor
typedef ACE_INET_Addr PEER_ADDR
typedef ACE_SOCK_Stream PEER_STREAM
Public Attributes inherited from ACE_SOCK_Acceptor
 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.
Public Attributes inherited from ACE_SOCK
 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.
Public Attributes inherited from ACE_IPC_SAP
 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.
Protected Member Functions inherited from ACE_SOCK_Acceptor
int shared_accept_start (ACE_Time_Value *timeout, bool restart, int &in_blocking_mode) const
int shared_accept_finish (ACE_SOCK_Stream new_stream, int in_blocking_mode, bool reset_new_handle) const
int shared_open (const ACE_Addr &local_sap, int protocol_family, int backlog, int ipv6_only)
Protected Member Functions inherited from ACE_SOCK
 ACE_SOCK (int type, int protocol_family, int protocol=0, int reuse_addr=0)
 ACE_SOCK (int type, int protocol_family, int protocol, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g, u_long flags, int reuse_addr)
 ACE_SOCK ()
 ~ACE_SOCK ()=default
 Protected destructor.
Protected Member Functions inherited from ACE_IPC_SAP
 ACE_IPC_SAP ()
 Default constructor.
 ~ACE_IPC_SAP ()
 Protected destructor.

Detailed Description

template<class ACE_LOCK>
class ACE_LOCK_SOCK_Acceptor< ACE_LOCK >

Specialize ACE_SOCK_Acceptor to lock around <accept>;.

This class is necessary since some OS platforms do not allow multiple threads/processes to simultaneously call accept on the same listen-mode port/socket. Thus, we need to protect against multiple concurrent accesses by using the appropriate type of lock.

Member Function Documentation

◆ accept()

template<class ACE_LOCK>
int ACE_LOCK_SOCK_Acceptor< ACE_LOCK >::accept ( ACE_SOCK_Stream & new_stream,
ACE_Addr * remote_addr = 0,
ACE_Time_Value * timeout = 0,
bool restart = true,
bool reset_new_handle = false ) const

Accept the connection under the control of the <ACE_LOCK>.

◆ lock()

template<class ACE_LOCK>
ACE_LOCK & ACE_LOCK_SOCK_Acceptor< ACE_LOCK >::lock ( )

Return a reference to the lock.

Member Data Documentation

◆ lock_

template<class ACE_LOCK>
ACE_LOCK ACE_LOCK_SOCK_Acceptor< ACE_LOCK >::lock_
protected

Type of locking mechanism.


The documentation for this class was generated from the following files: