#include <SOCK_CODgram.h>
Inheritance diagram for ACE_SOCK_CODgram:
Public Types | |
typedef ACE_INET_Addr | PEER_ADDR |
Public Member Functions | |
ACE_SOCK_CODgram (void) | |
Default constructor. | |
ACE_SOCK_CODgram (const ACE_Addr &remote_sap, const ACE_Addr &local_sap=ACE_Addr::sap_any, int protocol_family=ACE_PROTOCOL_FAMILY_INET, int protocol=0, int reuse_addr=0) | |
~ACE_SOCK_CODgram (void) | |
Default dtor. | |
int | open (const ACE_Addr &remote_sap, const ACE_Addr &local_sap=ACE_Addr::sap_any, int protocol_family=ACE_PROTOCOL_FAMILY_INET, int protocol=0, int reuse_addr=0) |
Initiate a connected dgram. | |
void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. |
Definition at line 36 of file SOCK_CODgram.h.
|
Definition at line 62 of file SOCK_CODgram.h. |
|
Default constructor.
Definition at line 8 of file SOCK_CODgram.inl. References ACE_TRACE.
00009 { 00010 ACE_TRACE ("ACE_SOCK_CODgram::ACE_SOCK_CODgram"); 00011 } |
|
Definition at line 27 of file SOCK_CODgram.cpp. References ACE_ERROR, ACE_TEXT, ACE_TRACE, LM_ERROR, and open().
|
|
Default dtor.
Definition at line 14 of file SOCK_CODgram.inl. References ACE_TRACE.
00015 { 00016 ACE_TRACE ("ACE_SOCK_CODgram::~ACE_SOCK_CODgram"); 00017 } |
|
Dump the state of an object.
Reimplemented from ACE_SOCK_IO. Reimplemented in ACE_LSOCK_CODgram. Definition at line 18 of file SOCK_CODgram.cpp. References ACE_TRACE. Referenced by ACE_LSOCK_CODgram::dump().
00019 { 00020 #if defined (ACE_HAS_DUMP) 00021 ACE_TRACE ("ACE_SOCK_CODgram::dump"); 00022 #endif /* ACE_HAS_DUMP */ 00023 } |
|
Initiate a connected dgram.
Definition at line 59 of file SOCK_CODgram.cpp. References ACE_TRACE, ACE_OS::bind(), ACE::bind_port(), ACE_SOCK::close(), ACE_OS::connect(), ACE_Addr::get_addr(), ACE_Addr::get_size(), ACE_SOCK::open(), PF_INET, ACE_IPC_SAP::set_handle(), and SOCK_DGRAM. Referenced by ACE_SOCK_CODgram(), and ACE_LSOCK_CODgram::open().
00062 { 00063 ACE_TRACE ("ACE_SOCK_CODgram::open"); 00064 if (ACE_SOCK::open (SOCK_DGRAM, protocol_family, 00065 protocol, reuse_addr) == -1) 00066 return -1; 00067 else 00068 { 00069 int error = 0; 00070 00071 if (local == ACE_Addr::sap_any && remote == ACE_Addr::sap_any) 00072 { 00073 // Assign an arbitrary port number from the transient range!! 00074 00075 if (protocol_family == PF_INET 00076 && ACE::bind_port (this->get_handle ()) == -1) 00077 error = 1; 00078 } 00079 // We are binding just the local address. 00080 else if (local != ACE_Addr::sap_any && remote == ACE_Addr::sap_any) 00081 { 00082 if (ACE_OS::bind (this->get_handle (), (sockaddr *) local.get_addr (), 00083 local.get_size ()) == -1) 00084 error = 1; 00085 } 00086 // We are connecting to the remote address. 00087 else if (local == ACE_Addr::sap_any && remote != ACE_Addr::sap_any) 00088 { 00089 if (ACE_OS::connect (this->get_handle (), (sockaddr *) remote.get_addr (), 00090 remote.get_size ()) == -1) 00091 error = 1; 00092 } 00093 // We are binding to the local address and connecting to the 00094 // remote addresses. 00095 else 00096 { 00097 if (ACE_OS::bind (this->get_handle (), (sockaddr *) local.get_addr (), 00098 local.get_size ()) == -1 00099 || ACE_OS::connect (this->get_handle (), (sockaddr *) remote.get_addr (), 00100 remote.get_size ()) == -1) 00101 error = 1; 00102 } 00103 if (error) 00104 { 00105 this->close (); 00106 this->set_handle (ACE_INVALID_HANDLE); 00107 } 00108 return error ? -1 : 0; 00109 } 00110 } |
|
Declare the dynamic allocation hooks.
Reimplemented from ACE_SOCK_IO. Reimplemented in ACE_LSOCK_CODgram. Definition at line 68 of file SOCK_CODgram.h. |