hi ,
i'm new to symbian and i'm certainly trying to play with the methods
in the RSockets classes for my TCP listener ...
i'll tell u what exactly i am doing..all my method calls are from the
RSockets class are in the foll sequence..
1. Open() method to create a blank socket
2. Bind() method used to bind to port (7030 in my case).
3. Listen() method to specify no. of client allowed to connect.
4. Accept() method to marry the incoming socket to the blank socket
which'll be passed as a parameter to the Accept() method.
It works perfectly fine uptil after the Accept() call...and then it
gives me a App.Closed panic error 17. I also checked out the error
codes and error 17 says - No Sockets currently open.
I dunno if my Accept call is right...coz the Accept(RSocket&
aBlankSocket) takes an RSocket (addressOf)object as a parameter and
the docs clearly says..it shud be an blank socket..so i make use of
the Open(RSocketServ& aServer) using an RSocket obj and pass it as a
parameter to the Accept() call...I wonder if this is correct...???
dunno where i am doing wat wrong...??
Am also adding my listener method...
Quote : *********************************
void CSocketsEngine::Listen() // <a name="ConnectL32">
{
//Initiate attempt to connect to a socket by IP address
if (iEngineStatus == ENotConnected)
{
//Open a TCP socket
User::LeaveIfError(iSocket.Open(iSocketServ, KAfInet,
KSockStream, KProtocolInetTcp));
//Binding to port 7030
TUint portNum = 7030;
TSockAddr tsaPort;
tsaPort.SetPort(portNum);
TInt bindStat = iSocket.Bind(tsaPort);
if (bindStat == KErrNone) {
TBuf8<10> stat;
_LIT8(kStat,"%d"😉;
stat.Format(kStat,bindStat);
iConsole.ErrorNotify(_L("Bind Success"😉,
iEngineStatus);
}
//Listening for socket connections
TUint queSize = 5;
TUint popConn;
iConsole.ErrorNotify(_L("Before Listen Call"😉,
iEngineStatus);
popConn = iSocket.Listen(queSize);
TBuf8<5> statListen;
_LIT8(kstatListen,"%d"😉;
statListen.Format(kstatListen,popConn);
iConsole.ErrorNotify(_L("Listen QueSize Set"😉,
iEngineStatus);
//Accept every connection as and when it comes in
from the
//listen call..
RSocket blankRSock;
TInt blsock = 0;
blsock =
User::LeaveIfError(blankRSock.Open(iSocketServ));
TRequestStatus reqStat(blsock);
iSocket.Accept(blankRSock,reqStat);
TBuf8<20> inData;
inData.Zero();
TRequestStatus connStat;
if (reqStat == KErrNone) {
iConsole.ErrorNotify(_L("After Accept..."😉,
iEngineStatus);
}
blankRSock.Read(inData,reqStat);
iConsole.ErrorNotify(_L("The incoming value "😉,
iEngineStatus);
}
}
UnQuote : *******************************
the code compiles fine...but gives the app closed panic 17 error at
run time. I'd be happy happy happy if any o u cud give me any leads
regarding this.
thanks,
adios,
LearningCurve.