本文整理汇总了C++中ACE_Name_Request::encode方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Name_Request::encode方法的具体用法?C++ ACE_Name_Request::encode怎么用?C++ ACE_Name_Request::encode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Name_Request
的用法示例。
在下文中一共展示了ACE_Name_Request::encode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
int
ACE_Name_Proxy::request_reply (ACE_Name_Request &request)
{
ACE_TRACE ("ACE_Name_Proxy::request_reply");
void *buffer;
ssize_t length = request.encode (buffer);
if (length == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("encode failed")),
-1);
// Transmit request via a blocking send.
if (this->peer_.send_n (buffer, length) != length)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("send_n failed")),
-1);
else
{
ACE_Name_Reply reply;
// Receive reply via blocking read.
if (this->peer_.recv_n (&reply,
sizeof reply) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("recv failed")),
-1);
else if (reply.decode () == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("decode failed")),
-1);
errno = int (reply.errnum ());
return reply.status ();
}
}
示例2:
/* VIRTUAL */ int
ACE_Name_Handler::send_request (ACE_Name_Request &request)
{
ACE_TRACE (ACE_TEXT ("ACE_Name_Handler::send_request"));
void *buffer;
ssize_t length = request.encode (buffer);
if (length == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("encode failed")),
-1);
// Transmit request via a blocking send.
if (this->peer ().send_n (buffer, length) != length)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("send_n failed")),
-1);
return 0;
}
示例3: if
int
ACE_Name_Proxy::send_request (ACE_Name_Request &request)
{
ACE_TRACE ("ACE_Name_Proxy::send_request");
void *buffer;
ssize_t length = request.encode (buffer);
if (length == -1)
ACELIB_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("encode failed")),
-1);
// Transmit request via a blocking send.
else if (this->peer_.send_n (buffer, length) != length)
ACELIB_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("send_n failed")),
-1);
return 0;
}