本文整理汇总了C++中ACE_Name_Request::decode方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Name_Request::decode方法的具体用法?C++ ACE_Name_Request::decode怎么用?C++ ACE_Name_Request::decode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Name_Request
的用法示例。
在下文中一共展示了ACE_Name_Request::decode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
int
ACE_Name_Proxy::recv_reply (ACE_Name_Request &reply)
{
ACE_TRACE ("ACE_Name_Proxy::recv_reply");
// Read the first 4 bytes to get the length of the message This
// implementation assumes that the first 4 bytes are the length of
// the message.
ssize_t n = this->peer_.recv ((void *) &reply, sizeof (ACE_UINT32));
switch (n)
{
case -1:
// FALLTHROUGH
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("****************** recv_reply returned -1\n")));
default:
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p got %d bytes, expected %d bytes\n"),
ACE_TEXT ("recv failed"),
n,
sizeof (ACE_UINT32)));
// FALLTHROUGH
case 0:
// We've shutdown unexpectedly
return -1;
// NOTREACHED
case sizeof (ACE_UINT32):
{
// Transform the length into host byte order.
ssize_t length = ACE_NTOHL (reply.length ());
// Receive the rest of the request message.
// @@ beware of blocking read!!!.
n = this->peer_.recv ((void *) (((char *) &reply)
+ sizeof (ACE_UINT32)),
length - sizeof (ACE_UINT32));
// Subtract off the size of the part we skipped over...
if (n != ssize_t (length - sizeof (ACE_UINT32)))
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p expected %d, got %d\n"),
ACE_TEXT ("invalid length"),
length,
n));
return -1;
}
// Decode the request into host byte order.
if (reply.decode () == -1)
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("decode failed")));
return -1;
}
}
}
return 0;
}