RSocket write problem :Didster Can U plz look into this
| Mon, 2005-12-19 16:20 | |
|
Hi,
I developed a simple exe which accepts the incoming socket connection from my gui application running on the same device Everything is working fine, but on every 36th request from gui app on exe Rsocket.:Write/RecvOneOrMore method return KErrNoMemory(-4). if i restart the gui app then the same things repeats again. I debugged it many times but haven’t found any clue to rectify it... Please suggest some pointer on it void DaemonMainL() { gConsole->Printf(_L("Starting!\n")); TUint KTestPort=8100; TInt lCnt = 0; TInetAddr addr(KInetAddrLoop, KTestPort); RSocketServ socketServ; RSocket listener; RSocket blank; TRequestStatus status; User::LeaveIfError(socketServ.Connect()); CleanupClosePushL(socketServ); User::LeaveIfError(listener.Open(socketServ, KAfInet,KSockStream, KProtocolInetTcp)); User::LeaveIfError(listener.Bind(addr)); User::LeaveIfError(listener.Listen(1)); TSockXfrLength dummyLength; TBool running = ETrue; TInt Error = EFalse; HBufC8* buffer =(HBufC8*)NULL; while(running) { blank.Open(socketServ); listener.Accept(blank, status); User::WaitForRequest(status); if(status == KErrNone ) { buffer = HBufC8::NewLC(2); blank.RecvOneOrMore(buffer->Des(), 0, status, dummyLength); User::WaitForRequest(status); if(status == KErrNone) { //on every 36 write it return kerrnomemory blank.Write(_L8(“symbian exe”), status); User::WaitForRequest(status); } if(buffer != (HBufC8*)NULL) { CleanupStack::PopAndDestroy(buffer); buffer = (HBufC8*)NULL; gConsole->Printf(_L(" buffer deleted")); } } blank.CancelAll(); blank.Close(); }//end of while loop CleanupStack::Pop(&socketServ); socketServ.Close(); } void ConsoleMainL() { gConsole = Console::NewL( _L("Simple Socket Server"), TSize(KConsFullScreen, KConsFullScreen) ); CleanupStack::PushL(gConsole); TRAPD(error, DaemonMainL()); if(error != KErrNone) { gConsole->Printf(_L("DaemonMainL failed! = %d"),error); } CleanupStack::PopAndDestroy(gConsole); } TInt E32Main() { __UHEAP_MARK; CTrapCleanup* cleanupStack = CTrapCleanup::New(); TRAPD(err, ConsoleMainL()); delete cleanupStack; __UHEAP_MARKEND; return KErrNone; } Core |
|





