Hi
I want to develop an application about Rsocket on UIQ P800. The application is to build an echo server on P800 phone. When any outside clients connect to the echoserver, the server will accept the connection, and then echo back any data received from the clients. The problem is that:
1. Now I�m able to accept the client connects by accept( ) call. (I confirmed this at client side. It displayed �successful connection�).
2. I can send data to clients successfully. I used iSocket.Send( ), and send a �Hellworld!� to client side. The client side does receive the �Helloworld�.
3. I found I cannot receive any data by RecvOneOrMore( ).
I think it is a synchronization problem, but I don�t know how to fix it up. My code is like:
[FONT=Courier New]Void CSecEngine::StartEngineL( )
{
//
//Need to use two sockets -one to listen for an incoming connection
User::LeaveIfError( iListen.Open( iSocketServ, KAfInet, KSockStream, KProtocolInetTcp ) );
//The second socket is required to build the connection & transfer data.
User::LeaveIfError( iSocket.Open( iSocketServ ) );
//bind to port 5000
TInetAddr anyAddrOnPort(KInetAddrAny, 5000);
iListen.Bind(anyAddrOnPort);
//Listen for incoming connections
iListen.Listen(1);
iListen.Accept(iSocket, iStatus);
SetActive();
}
void CSecEngine::RunL()
{
if(iStatus == KErrNone)
{
iRcvBuffer.SetLength( 0 );
iSocket.RecvOneOrMore( iRcvBuffer, 0, iStatus, iBytesRecv );
}
//
//[/FONT]
I printed out the iRcvBuffer, but it�s empty. I cannot receive any data. Why?
Thanks in advance.
Regards,
Hantao