diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2004-05-18 11:22:02 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2004-05-18 11:22:02 +0000 |
commit | 0e414d0a0726c633863ac54614d9763cbd2d1b40 (patch) | |
tree | e05035e81091a1fe73c5cc109352b4a776bbcce7 /ace/SOCK_CODgram.cpp | |
parent | f0666d67509e7cd31ce39747e37c77656b07ab2d (diff) | |
download | ATCD-0e414d0a0726c633863ac54614d9763cbd2d1b40.tar.gz |
ChangeLogTag: Tue May 18 11:21:21 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'ace/SOCK_CODgram.cpp')
-rw-r--r-- | ace/SOCK_CODgram.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/ace/SOCK_CODgram.cpp b/ace/SOCK_CODgram.cpp index 78bc2401178..c7af4bd69d3 100644 --- a/ace/SOCK_CODgram.cpp +++ b/ace/SOCK_CODgram.cpp @@ -4,9 +4,9 @@ #include "ace/SOCK_CODgram.h" #include "ace/Log_Msg.h" -#if defined (ACE_LACKS_INLINE_FUNCTIONS) +#if !defined (__ACE_INLINE__) #include "ace/SOCK_CODgram.i" -#endif +#endif /* __ACE_INLINE__ */ ACE_RCSID(ace, SOCK_CODgram, "$Id$") @@ -22,12 +22,12 @@ ACE_SOCK_CODgram::dump (void) const // Here's the general-purpose constructor. -ACE_SOCK_CODgram::ACE_SOCK_CODgram (const ACE_Addr &remote, const ACE_Addr &local, - int protocol_family, int protocol, +ACE_SOCK_CODgram::ACE_SOCK_CODgram (const ACE_Addr &remote, const ACE_Addr &local, + int protocol_family, int protocol, int reuse_addr) { ACE_TRACE ("ACE_SOCK_CODgram::ACE_SOCK_CODgram"); - if (this->open (remote, local, + if (this->open (remote, local, protocol_family, protocol, reuse_addr) == -1) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_SOCK_CODgram"))); } @@ -35,10 +35,10 @@ ACE_SOCK_CODgram::ACE_SOCK_CODgram (const ACE_Addr &remote, const ACE_Addr &loca /* This is the general-purpose open routine. Note that it performs a different set of functions depending on the LOCAL and REMOTE addresses passed to it. Here's the basic logic: - + 1. remote == ACE_Addr::sap_any && local == ACE_Addr::sap_any - if protocol_family == PF_INET then - bind the local address to a randomly generated port number... + if protocol_family == PF_INET then + bind the local address to a randomly generated port number... 2. remote == ACE_Addr::sap_any && local != ACE_Addr::sap_any we are just binding the local address @@ -49,8 +49,8 @@ ACE_SOCK_CODgram::ACE_SOCK_CODgram (const ACE_Addr &remote, const ACE_Addr &loca (used primarily by clients) 4. remote != ACE_Addr::sap_any && local != ACE_Addr::sap_any - we are binding to the local address - and connecting to the remote address + we are binding to the local address + and connecting to the remote address */ int @@ -59,7 +59,7 @@ ACE_SOCK_CODgram::open (const ACE_Addr &remote, const ACE_Addr &local, int reuse_addr) { ACE_TRACE ("ACE_SOCK_CODgram::open"); - if (ACE_SOCK::open (SOCK_DGRAM, protocol_family, + if (ACE_SOCK::open (SOCK_DGRAM, protocol_family, protocol, reuse_addr) == -1) return -1; else @@ -70,21 +70,21 @@ ACE_SOCK_CODgram::open (const ACE_Addr &remote, const ACE_Addr &local, { // Assign an arbitrary port number from the transient range!! - if (protocol_family == PF_INET + if (protocol_family == PF_INET && ACE::bind_port (this->get_handle ()) == -1) error = 1; } - // We are binding just the local address. + // We are binding just the local address. else if (local != ACE_Addr::sap_any && remote == ACE_Addr::sap_any) { - if (ACE_OS::bind (this->get_handle (), (sockaddr *) local.get_addr (), + if (ACE_OS::bind (this->get_handle (), (sockaddr *) local.get_addr (), local.get_size ()) == -1) error = 1; } - // We are connecting to the remote address. + // We are connecting to the remote address. else if (local == ACE_Addr::sap_any && remote != ACE_Addr::sap_any) { - if (ACE_OS::connect (this->get_handle (), (sockaddr *) remote.get_addr (), + if (ACE_OS::connect (this->get_handle (), (sockaddr *) remote.get_addr (), remote.get_size ()) == -1) error = 1; } @@ -92,9 +92,9 @@ ACE_SOCK_CODgram::open (const ACE_Addr &remote, const ACE_Addr &local, // remote addresses. else { - if (ACE_OS::bind (this->get_handle (), (sockaddr *) local.get_addr (), + if (ACE_OS::bind (this->get_handle (), (sockaddr *) local.get_addr (), local.get_size ()) == -1 - || ACE_OS::connect (this->get_handle (), (sockaddr *) remote.get_addr (), + || ACE_OS::connect (this->get_handle (), (sockaddr *) remote.get_addr (), remote.get_size ()) == -1) error = 1; } |