当前位置: 首页>>代码示例>>C++>>正文


C++ ACE_Addr::get_type方法代码示例

本文整理汇总了C++中ACE_Addr::get_type方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Addr::get_type方法的具体用法?C++ ACE_Addr::get_type怎么用?C++ ACE_Addr::get_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ACE_Addr的用法示例。


在下文中一共展示了ACE_Addr::get_type方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

// Actively connect and produce a new ACE_SOCK_Stream if things go well...
int
ACE_SOCK_Connector::connect (ACE_SOCK_Stream &new_stream,
                             const ACE_Addr &remote_sap,
                             const ACE_Time_Value *timeout,
                             const ACE_Addr &local_sap,
                             int reuse_addr,
                             int /* flags */,
                             int /* perms */,
                             int protocol)
{
  ACE_TRACE ("ACE_SOCK_Connector::connect");

  if (this->shared_open (new_stream,
                         remote_sap.get_type (),
                         protocol,
                         reuse_addr) == -1)
    return -1;
  else if (this->shared_connect_start (new_stream,
                                       timeout,
                                       local_sap) == -1)
    return -1;

  int result = ACE_OS::connect (new_stream.get_handle (),
                                reinterpret_cast<sockaddr *> (remote_sap.get_addr ()),
                                remote_sap.get_size ());

  return this->shared_connect_finish (new_stream, timeout, result);
}
开发者ID:AtVirus,项目名称:SkyFireEMU,代码行数:29,代码来源:SOCK_Connector.cpp

示例2: if

int
ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap,
                         int reuse_addr,
                         int protocol_family,
                         int backlog,
                         int protocol)
{
  ACE_TRACE ("ACE_SOCK_Acceptor::open");

  if (local_sap != ACE_Addr::sap_any)
    protocol_family = local_sap.get_type ();
  else if (protocol_family == PF_UNSPEC)
    {
#if defined (ACE_HAS_IPV6)
      protocol_family = ACE::ipv6_enabled () ? PF_INET6 : PF_INET;
#else
      protocol_family = PF_INET;
#endif /* ACE_HAS_IPV6 */
    }

  if (ACE_SOCK::open (SOCK_STREAM,
                      protocol_family,
                      protocol,
                      reuse_addr) == -1)
    return -1;
  else
    return this->shared_open (local_sap,
                              protocol_family,
                              backlog);
}
开发者ID:GlassFace,项目名称:sunwell,代码行数:30,代码来源:SOCK_Acceptor.cpp

示例3:

int
ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap,
                         ACE_Protocol_Info *protocolinfo,
                         ACE_SOCK_GROUP g,
                         u_long flags,
                         int reuse_addr,
                         int protocol_family,
                         int backlog,
                         int protocol)
{
  ACE_TRACE ("ACE_SOCK_Acceptor::open");

  if (protocol_family == PF_UNSPEC)
    protocol_family = local_sap.get_type ();

  if (ACE_SOCK::open (SOCK_STREAM,
                      protocol_family,
                      protocol,
                      protocolinfo,
                      g,
                      flags,
                      reuse_addr) == -1)
    return -1;
  else
    return this->shared_open (local_sap,
                              protocol_family,
                              backlog);
}
开发者ID:GlassFace,项目名称:sunwell,代码行数:28,代码来源:SOCK_Acceptor.cpp

示例4:

ACE_CLASSIX_Port::ACE_CLASSIX_Port(ACE_Addr const& theAddr)
    : ACE_CLASSIX_Addr (sizeof (ACE_CLASSIX_Port_Core::Addr))
{
    if (theAddr.get_size() == this->get_size() &&
	theAddr.get_type() == this->get_type())
	this->set_(theAddr);
    else
	this->clear();
}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:9,代码来源:CLASSIX_Port.cpp

示例5: if

int
ACE_SOCK_Connector::connect (ACE_SOCK_Stream &new_stream,
                             const ACE_Addr &remote_sap,
                             ACE_QoS_Params qos_params,
                             const ACE_Time_Value *timeout,
                             const ACE_Addr &local_sap,
                             ACE_Protocol_Info * protocolinfo,
                             ACE_SOCK_GROUP g,
                             u_long flags,
                             int reuse_addr,
                             int /* perms */)
{
  ACE_TRACE ("ACE_SOCK_Connector::connect");

  if (this->shared_open (new_stream,
                         remote_sap.get_type (),
                         0,
                         protocolinfo,
                         g,
                         flags,
                         reuse_addr) == -1)
    return -1;
  else if (this->shared_connect_start (new_stream,
                                       timeout,
                                       local_sap) == -1)
    return -1;

  int result = ACE_OS::connect (new_stream.get_handle (),
                                reinterpret_cast<sockaddr *> (remote_sap.get_addr ()),
                                remote_sap.get_size (),
                                qos_params);

  return this->shared_connect_finish (new_stream,
                                      timeout,
                                      result);
}
开发者ID:aresxii,项目名称:aresxii,代码行数:36,代码来源:SOCK_Connector.cpp

示例6: if

int
SCTP_Connector::connect (ACE_SOCK_SEQPACK_Association &new_association,
                             const ACE_Addr &remote_sap,
                             const ACE_Time_Value *timeout,
                             const ACE_Addr &local_sap,
                             int reuse_addr,
                             int /* flags */,
                             int /* perms */,
                             int protocol)
{
  ACE_TRACE ("SCTP_Connector::connect");

  if (this->shared_open (new_association,
                         remote_sap.get_type (),
                         protocol,
                         reuse_addr) == -1)
    return -1;
  else if (this->shared_connect_start (new_association,
                                       timeout,
                                       local_sap) == -1)
    return -1;

  if (new_association.set_option(SOL_SCTP,
                                 SCTP_HEARTBEAT_ITVL,
                                 &heart_beat_,
                                 sizeof(heart_beat_)) == -1)
    return -1;

  int result = ACE_OS::connect (new_association.get_handle (),
                                reinterpret_cast<sockaddr *> (remote_sap.get_addr ()),
                                remote_sap.get_size ());

  return this->shared_connect_finish (new_association,
                                      timeout,
                                      result);
}
开发者ID:CCJY,项目名称:ATCD,代码行数:36,代码来源:SCTP_Fault_Detector.cpp

示例7: if

int
ACE_SOCK_CODgram::open (const ACE_Addr &remote, const ACE_Addr &local,
                        int protocol_family, int protocol,
                        int reuse_addr)
{
  ACE_TRACE ("ACE_SOCK_CODgram::open");
  // Depending on the addresses passed as described above, figure out what
  // address family to specify for the new socket. If either address is
  // !ACE_Addr::sap_any, use that family. If they don't match, it's an error.
  if (remote != ACE_Addr::sap_any)
    {
      if (local == ACE_Addr::sap_any)
        protocol_family = remote.get_type ();
      else
        { // Both specified; family must match
          if (local.get_type () != remote.get_type ())
            {
              errno = EAFNOSUPPORT;
              return -1;
            }
          protocol_family = remote.get_type ();
        }
    }
  else
    {
      if (local != ACE_Addr::sap_any)
        {
          protocol_family = local.get_type ();
        }
    }
  if (ACE_SOCK::open (SOCK_DGRAM,
                      protocol_family,
                      protocol,
                      reuse_addr) == -1)
    {
      return -1;
    }
  else
    {
      bool error = false;

      if (local == ACE_Addr::sap_any && remote == ACE_Addr::sap_any)
        {
          // Assign an arbitrary port number from the transient range!!
          if ((protocol_family == PF_INET
#if defined (ACE_HAS_IPV6)
               || protocol_family == PF_INET6
#endif /* ACE_HAS_IPV6 */
              ) && ACE::bind_port (this->get_handle ()) == -1)
            error = true;
        }
      // 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 (),
                            local.get_size ()) == -1)
            error = true;
        }
      // 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 (),
                               remote.get_size ()) == -1)
            error = true;
        }
      // We are binding to the local address and connecting to the
      // remote addresses.
      else
        {
          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 (),
                                  remote.get_size ()) == -1)
            error = true;
        }
      if (error)
        {
          this->close ();
          this->set_handle (ACE_INVALID_HANDLE);
        }
      return error ? -1 : 0;
    }
}
开发者ID:Adeer,项目名称:OregonCore,代码行数:87,代码来源:SOCK_CODgram.cpp


注:本文中的ACE_Addr::get_type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。