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);
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.
I was wondering how u were able to connect the emulator to the internet. I have read lots of tutorials on how to do this but all of them require at least a NULL modem.
Have any of you managed to do this only by software?
RSocket::Listen and RSocket::Bind are synchronous services. You don't have to use req. status when calling these methods. Note that you should pass a TInetAddr instead of a TSockAddr, because TSockAddr is for further derivation and TInetAddr is one of its successors.
On the other hand, RSocket::Accept and RSocket::Read are asynchronous operations. What is missing then from your code? Well, I have not seen that you wait for the completion of your Accept call. That is the source of your problem : it is not enough to call Accept synchronously. Having Accept operation completed, you may issue the other asynchronous request, Read.
Has anyone successfully implemented a socket server using the socket()
bind()
listen()
accept() calls using the Symbian Rsocket class?
I know that all the documentation available on Symbian / Series 60 SDK mentions that it works using Active Objects.
However, like the original message above, the socket server implemeted on the cell phone / series 60 sdk emulator does not get any notification of an incoming connection request.
So has anyone implemented the socket server application which accepts incoming connection requests on the cell phone? Or for that matter used the UDP call in the RSocket - RecvFrom successfully?