本文整理汇总了C++中TInetAddr::Copy方法的典型用法代码示例。如果您正苦于以下问题:C++ TInetAddr::Copy方法的具体用法?C++ TInetAddr::Copy怎么用?C++ TInetAddr::Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TInetAddr
的用法示例。
在下文中一共展示了TInetAddr::Copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bufPtr
void CWin32Socket::SendTo(TWin32Message& aMessage)
{
__ASSERT_DEBUG((iSendMessage == NULL) && (iBytesSent == 0), Panic(EWinSockPrtCWin32SocketMultipleSendToRequests));
iSendMessage = &aMessage;
WSP_LOG(WspLog::Printf(_L("CWin32Socket::SendTo: this: 0x%x, bytes to send: %d"), this, iSendMessage->ReadBuffer().Length()));
TPtrC8 bufPtr(iSendMessage->ReadBuffer());
iSendBuffer.buf = reinterpret_cast<char*>(const_cast<TUint8*>(bufPtr.Ptr()));
iSendBuffer.len = bufPtr.Length();
iSendOverlapped.hEvent = (void*) this;
TInetAddr address;
address.Copy(iSendMessage->WriteBuffer());
SOCKADDR_IN winSockAddress;
ConvertAddress(address, winSockAddress);
DWORD numberOfBytesSent;
TInt ret = WSASendTo(iSocket, &iSendBuffer, 1, &numberOfBytesSent, 0, (LPSOCKADDR)&winSockAddress, sizeof(struct sockaddr_in), &iSendOverlapped, &SendToCompletion);
if (ret == SOCKET_ERROR)
{
TInt err = WSAGetLastError();
if (err != WSA_IO_PENDING)
{
WSP_LOG(WspLog::Printf(_L("\tsocket error: %d"), err));
Complete(iSendMessage, MapWinSockError(err));
}
}
}
示例2: PrintContextConfig
void CEtelContextNotificationRequest::PrintContextConfig(
const TContextConfig& aContextConfig)
{
LOG(Log::Printf(_L("** Context config data **")));
RPacketContext::TContextConfigGPRS tempConfig;
aContextConfig.GetContextConfig(tempConfig);
RPacketContext::TProtocolAddress pdpAddress;
aContextConfig.GetPdpAddress(pdpAddress);
TInetAddr pdpAddr;
pdpAddr.Copy(pdpAddress);
TBuf<RPacketContext::KMaxPDPAddressLength> outBuf;
pdpAddr.Output(outBuf);
switch(tempConfig.iPdpType)
{
case RPacketContext::EPdpTypeIPv4:
{
LOG(Log::Printf(_L("\tPdpType: IPv4")));
break;
}
case RPacketContext::EPdpTypeIPv6:
{
LOG(Log::Printf(_L("\tPdpType: IPv6")));
break;
}
case RPacketContext::EPdpTypeX25:
{
LOG(Log::Printf(_L("\tPdpType: X25")));
break;
}
default:
{
LOG(Log::Printf(_L("\tPdpType: UNRECOGNIZED")));
break;
}
}
LOG(Log::Printf(_L8("\tAccess Point Name: <%s>"),
tempConfig.iAccessPointName.PtrZ()));
LOG(Log::Printf(_L("\tPdpAddress: <%s>"),
outBuf.PtrZ()));
if((tempConfig.iPdpCompression == RPacketContext::KPdpDataCompression) &&
(tempConfig.iPdpCompression == RPacketContext::KPdpHeaderCompression))
{
LOG(Log::Printf(_L("\tCompression: Header+Data")));
}
else if((tempConfig.iPdpCompression ==
RPacketContext::KPdpDataCompression))
{
LOG(Log::Printf(_L("\tCompression: Data")));
}
else if((tempConfig.iPdpCompression ==
RPacketContext::KPdpHeaderCompression))
{
LOG(Log::Printf(_L("\tCompression: Header")));
}
else if(tempConfig.iPdpCompression == 0)
{
LOG(Log::Printf(_L("\tCompression: None")));
}
else
{
LOG(Log::Printf(_L("\tCompression: UNRECOGNIZED")));
}
switch(tempConfig.iAnonymousAccessReqd)
{
case RPacketContext::ENotApplicable:
{
LOG(Log::Printf(
_L("\tAnonymous access required: ENotApplicable")));
break;
}
case RPacketContext::ERequired:
{
LOG(Log::Printf(_L("\tAnonymous access required: ERequired")));
break;
}
case RPacketContext::ENotRequired:
{
LOG(Log::Printf(
_L("\tAnonymous access required: ENotRequired")));
break;
}
default:
{
LOG(Log::Printf(
_L("\tAnonymous access required: UNRECOGNIZED")));
break;
}
}
}