Hello,
I have been trying to use the socket engine from SIP example code given into the SDK S60/ 9.1 /S60_3rd example code folder.
I am successful to communicate data to my local server listener port using this example where I am using its contructL as
Code:
iState = ENotConnected;
iConnectionSetupDone = EFalse;
selectedIAP = 0;
SelectAccessPointL(selectedIAP);//for selecting APN from list ...
iTimer = CSIPExTimeOutTimer::NewL( *this );
// Open channel to Socket Server
User::LeaveIfError( iSocketServer.Connect() );
TInetAddr::Cast(iNameRecord.iAddr).Output(ipAddr);
addr.SetAddress(KInetAddr);
ConnectL(selectedIAP,addr); //establish connection as client
//StartListeningL(selectedIAP);
iReader = CSIPExSocketReader::NewL( iDataSocket, *this );
iWriter = CSIPExSocketWriter::NewL( iDataSocket, *this );
where in ConnectL().. it is connected to server IP and then calls RUNL ()
In RUNL()... Code goes into the switch case with iState EConnecting and writes the data once....
Code:
switch( iState )
{
case EConnecting:
if( iStatus.Int() == KErrNone )
{
Log(_L8("\r\n In EConnecting KErrNone"));
ChangeStateAndNotify( EConnected );
Write(iBuf8);
}
else
{
Log(_L8("\r\n In EConnecting KErr"));
ChangeStateAndNotify( ENotConnected );
}
break;
till this , everything works oK.... and code comes to WriteDone method of SocketEngine after successful writing data on socket....
void CSIPExSocketEngineWrite::WriteDone()
{
Log(_L8("\r\n In WriteDone()"));
// Nothing to do
Observer.WriteSuccess();
}
Now ... I have implemented the observer for this socketengine where after WriteDone() / or error occured state is communicated back to the AppUi...function .....
Once data written complete... I want to again send a differnt packet data to the same server on same socket.... So I called Write methode of socket engine....which is something like as
Code from SocketEngine:
Write( const TDesC8& aTxt )
{
Log(_L8("\r\n In Write()"));
if( iState == EConnected && !iWriter->IsActive() )
{
iWriter->Write( aTxt );
}
}
As I called this method, apps exited with KERREXEC 3 .... I dint get any reason for this error here....
Please guide... how can I call Write() method of SocketEngine from AppUi ...
( I am making sure 100%, the earlier write() call is over and Active obj of socketEngine is not called from anywhere else....)
Any help regarding this is highly appreciated ...




