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


C++ ACE_TLI_Stream::rcvdis方法代码示例

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


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

示例1: if


//.........这里部分代码省略.........
                             localaddr->addr.len);

              if (ACE_OS::t_bind (new_stream.get_handle (),
                                  localaddr,
                                  localaddr) == -1)
                result = -1;

              ACE_OS::t_free ((char *) localaddr,
                              T_BIND);
            }
        }

      if (result == -1)
        {
          new_stream.close ();
          return -1;
        }
    }
  // Let TLI select the local endpoint addr.
  else if (ACE_OS::t_bind (new_stream.get_handle (), 0, 0) == -1)
    return -1;

  struct t_call *callptr = 0;

  callptr = (struct t_call *)
    ACE_OS::t_alloc (new_stream.get_handle (), T_CALL, T_ADDR);

  if (callptr == 0)
    {
      new_stream.close ();
      return -1;
    }

  void *addr_buf = remote_sap.get_addr ();
  callptr->addr.len = remote_sap.get_size ();
  ACE_OS::memcpy (callptr->addr.buf,
                  addr_buf,
                  callptr->addr.len);
  //callptr->addr.buf = (char *) remote_sap.get_addr ();

  if (udata != 0)
    ACE_OS::memcpy ((void *) &callptr->udata, (void *) udata, sizeof *udata);
  if (opt != 0)
    ACE_OS::memcpy ((void *) &callptr->opt, (void *) opt, sizeof *opt);

  // Connect to remote endpoint.
#if defined (ACE_HAS_FORE_ATM_XTI)
  // FORE's XTI/ATM driver has problems with ioctl/fcntl calls so (at least
  // for now) always have blocking calls.
  timeout = 0;
#endif /* ACE_HAS_FORE_ATM_XTI */

  if (timeout != 0)   // Enable non-blocking, if required.
    {
      if (new_stream.enable (ACE_NONBLOCK) == -1)
        result = -1;

      // Do a non-blocking connect.
      if (ACE_OS::t_connect (new_stream.get_handle (), callptr, 0) == -1)
        {
          result = -1;

          // Check to see if we simply haven't connected yet on a
          // non-blocking handle or whether there's really an error.
          if (t_errno == TNODATA)
            {
              if (*timeout == ACE_Time_Value::zero)
                errno = EWOULDBLOCK;
              else
                result = this->complete (new_stream, 0, timeout);
            }
          else if (t_errno == TLOOK && new_stream.look () == T_DISCONNECT)
            new_stream.rcvdis ();
        }
    }
  // Do a blocking connect to the server.
  else if (ACE_OS::t_connect (new_stream.get_handle (), callptr, 0) == -1)
    result = -1;

  if (result != -1)
    {
      new_stream.set_rwflag (rwf);
#if defined (I_PUSH) && !defined (ACE_HAS_FORE_ATM_XTI)
      if (new_stream.get_rwflag ())
        result = ACE_OS::ioctl (new_stream.get_handle (),
                                I_PUSH,
                                const_cast<char *> ("tirdwr"));
#endif /* I_PUSH */
    }
  else if (!(errno == EWOULDBLOCK || errno == ETIME))
    {
      // If things have gone wrong, close down and return an error.
      new_stream.close ();
      new_stream.set_handle (ACE_INVALID_HANDLE);
    }

  if (ACE_OS::t_free ((char *) callptr, T_CALL) == -1)
    return -1;
  return result;
}
开发者ID:08keelr,项目名称:TrinityCore,代码行数:101,代码来源:TLI_Connector.cpp


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