I'm trying to stop an active connection and then start a new one
using RGenericAgent, and I've run into problems.
Stopping seems to work fine, but then when I try to start it again,
using StartOutgoing() it fails with KErrInUse.
I've tried everything I can think of, including getting progress
nofications, waiting with User::After, closing the agent and
opening it again. Nothing seems to work. Any ideas anyone?
Any help at all would be much appreciated.
Hmm, this was quite a while ago, but I did find a solution for it. If I remember correctly this was caused by a known error in the Series60 platform. The solution was that when/if you get KErrInUse you simply have to try and call StartOutgoing again, and the second time it works. I simply added a retry mechanism to my RunL. If I got KErrInUse during connection stage I simply called StartOutgoing again. As far as I remember that solved the problem.
after some deep device logging it seems really that there is a problem if one wants to 'reuse' a new RGenericAgent for the current thread on Series60,v1.2 devices.
But a 'reuse' is not necessary.
One RGenericAgent is enough for the whole lifetime of your thread. In my case I open,stop & close the instance in the 'Server.cpp' .
Keep care that you 'wait' for the response of the StartOutgoing before you use the socket(s).
Tobias www.HBufC.com www.OutBank.de