void CJavaDebugAgentConnector::DoConnectL() { TInt port = iDriver->GetPCPort(); TBuf<KMaxInetAddrBufSize> addrBuf; iAddress.OutputWithScope(addrBuf); LOG2("Connecting to %S:%d", &addrBuf, port); iHandler = CTcpServerHandler::NewL(iDriver); iSocket = &iHandler->InitSocketL(SocketServ()); User::LeaveIfError(iSocket->Open(SocketServ(), KAfInet, KSockStream, KProtocolInetTcp)); iState = EConnecting; iStatus = KRequestPending; SetActive(); iAddress.SetPort(port); iSocket->Connect(iAddress, iStatus); }
void CJavaDebugAgentConnector::ConnectL() { if (iState == EIdle) { TDesC* host = iDriver->GetPCHost(); if (host && host->Length() > 0) { // NOTE: iApId is apparently so called "WAP id". It's different // from Internet AP id, which is what TCommDbConnPref wants. TUint32 iap = KNoAccessPoint; TBuf<KCommsDbSvrMaxFieldLength> apName; if (iApId != KNoAccessPoint) { // We will need the connection User::LeaveIfError(iConnection.Open(SocketServ(), KAfInet)); // Get IAP id and connection name CCommsDatabase* db = CCommsDatabase::NewL(); CleanupStack::PushL(db); CApUtils* apUtils = CApUtils::NewLC(*db); iap = apUtils->IapIdFromWapIdL(iApId); apUtils->NameL(iApId, apName); CleanupStack::PopAndDestroy(2); // apUtils, db } if (iap == KNoAccessPoint || AlreadyConnected(iap)) { DoResolveL(); } else { // Initiate the connection LOG1("Starting %S connection...",&apName); iState = EStarting; iStatus = KRequestPending; SetActive(); iConnPref.SetIapId(iap); iConnPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); iConnection.Start(iConnPref, iStatus); } } else { iState = EFailed; iDriver->Log(_L("PC host is not set!")); User::LeaveIfError(KErrArgument); } } }
void CJavaDebugAgentConnector::DoResolveL() { TDesC* host = iDriver->GetPCHost(); TInt err = iAddress.Input(*host); if (err != KErrNone) { User::LeaveIfError(iResolver.Open(SocketServ(), KAfInet, KProtocolInetTcp)); iState = EResolving; iStatus = KRequestPending; SetActive(); LOG1("Resolving %S",host); iResolver.GetByName(*host, iNameEntry, iStatus); } else { DoConnectL(); } }
TPVSocketEvent OsclAcceptMethod::Accept(int32 aTimeout) { //in case previous accepted socket was never //retrieved... DiscardAcceptedSocket(); iAcceptedSocket = OsclSocketI::NewL(Alloc()); if (iAcceptedSocket->Open(*SocketServ()) != OsclErrNone) { DiscardAcceptedSocket(); return EPVSocketFailure; } if (!StartMethod(aTimeout)) { DiscardAcceptedSocket(); return EPVSocketFailure; } AcceptRequest()->Accept(*iAcceptedSocket); return EPVSocketPending; }
// Initialize TInt PjSymbianOS::Initialize() { TInt err; selectTimeoutTimer_ = CPjTimeoutTimer::NewL(); #if 0 pj_assert(console_ == NULL); TRAPD(err, console_ = Console::NewL(_L("PJLIB"), TSize(KConsFullScreen,KConsFullScreen))); return err; #endif /* Only create RSocketServ if application doesn't specify it * in the parameters */ if (!isSocketServInitialized_ && appSocketServ_ == NULL) { err = socketServ_.Connect(PJ_SYMBIAN_SOCK_MSG_SLOTS); if (err != KErrNone) goto on_error; isSocketServInitialized_ = true; } if (!isResolverInitialized_) { if (appHostResolver_ == NULL) { if (Connection()) err = hostResolver_.Open(SocketServ(), KAfInet, KSockStream, *Connection()); else err = hostResolver_.Open(SocketServ(), KAfInet, KSockStream); if (err != KErrNone) goto on_error; } #if defined(PJ_HAS_IPV6) && PJ_HAS_IPV6!=0 if (appHostResolver6_ == NULL) { if (Connection()) err = hostResolver6_.Open(SocketServ(), KAfInet6, KSockStream, *Connection()); else err = hostResolver6_.Open(SocketServ(), KAfInet6, KSockStream); if (err != KErrNone) goto on_error; } #endif isResolverInitialized_ = true; } isConnectionUp_ = true; return KErrNone; on_error: Shutdown(); return err; }