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


C++ TInetAddr::Copy方法代码示例

本文整理汇总了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));
			}
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:25,代码来源:wsp_socket.cpp

示例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;
            }
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:98,代码来源:ContextNotifications.cpp


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