Use of RConnection for socket status

Login to reply to this topic.
Mon, 2007-03-26 08:03
Joined: 2005-02-14
Forum posts: 19
Any hints on what is the way to use RConnection attached to a specific RSocket be used specifically for verifying if a specific Socket is connected?


Thanks,
Tanuja

Mon, 2007-03-26 16:59
Forum Nokia Champion
Joined: 2004-05-26
Forum posts: 732
Re: Use of RConnection for socket status
Tue, 2007-03-27 06:46
Joined: 2005-02-14
Forum posts: 19
Re: Use of RConnection for socket status
Hi,
I am looking at implementing a function like

Code:
TBool IsConnected(RSocket* mySocket)

RConnection::enumerateConnections() only retrieves the number of active connections.

Thanks,
Tanuja
Tue, 2007-03-27 06:58
Forum Nokia Champion
Joined: 2004-05-26
Forum posts: 732
Re: Use of RConnection for socket status
Basically there is no API to get the connection status of your socket. A work around (usually developers use) is by the use of a AO status enum in your class (don't confuse it with the iStatus).

Code:
enum TAOState
    {
    EConnected,
    EDisconnected
    // add your additional states if any
    };

TAOState iAOState;

Now when ever a connection occured the RunL will hit then make your iAOState =  EConnected and same way if encountered a socket disconnection set iAOState = EDisconnected.

now you may create a function like this:

Code:
TBool CYourAO::IsConnected()
    {
    return (iState == EConnected )? ETrue: EFalse;
    }

Tue, 2007-03-27 07:45
Joined: 2005-02-14
Forum posts: 19
Re: Use of RConnection for socket status
We do not use AO framework for our sockets - the application being a huge one and there are good number of sockets used. And asynchronous operations of sockets is not desired. Outside of AO, is there no solution?

In the UIQ3SDK one finds in the description of RConnection, that RConnection can be used to get

Quote
The current status of the connection and subconnections with respect to data transfer, i.e. active/inactive

But there is no document that says how that is done!

I guess there is a combination of arguments for SetOpt on RConnection that could be used, that should be followed by a call to GetConnectionInfo();

I am not able to pin down the exact parameters!

Thanks,
Tanuja
Tue, 2007-03-27 08:50
Forum Nokia Champion
Joined: 2004-05-26
Forum posts: 732
Re: Use of RConnection for socket status
Check the RConnection::ServiceChangeNotification() API with the SDK Help. If you're working on Symbian OS 9.x then the RConnectionMonitor class also may be helpful for you.

  • Login to reply to this topic.