I am new to Symbian world. I really stuck with socket programming. I was doing simple client/server program. When I execute the Server program, I am getting error in the accept call. It is not waiting for any request to accept. That is why I have put the user::waitforrequest()
When I execute the client program it gives binding error 10048.
FYI: I am running two programs from same carbide window.
Here is my questions:
1. Why accept call does not block for the request to accept (may i am comparing unix socket programming, if rectify me concept)
2. In the connect we never bind, still why we are getting the binding error.
3. In my code I have given the port number 8100, but bind error gives the port number as 3651, I have not got why the port number is changed.
really I am confused, is it I need to run both program 2 different carbide C++, or am making any mistake in the code.
const TUint32 KInetAddr = INET_ADDR(127,0,0,1);
// Add to scheduler
TInt iReturn = iSocketServ.Connect();
if(iReturn != KErrNone)console->Write(_L("connected to RsocketServer"));
iReturn = iSocket.Open(iSocketServ,KAfInet,KSockStream,KProtocolInetTcp );
if(iReturn != KErrNone) console->Write(_L("open the socket\n"));
iReturn = iSocket.Bind(iAddr);
if(iReturn != KErrNone)console->Write(_L("Bind is successful\n"));
iReturn = iSocket.Listen(20);
if(iReturn != KErrNone)console->Write(_L("Listening successful\n"));
iReturn = iAccept.Open(iSocketServ);
if(iReturn != KErrNone)console->Write(_L("Blank Socket is created"));
if(iRequestStatus.Int() != KErrNone)console->Write(_L("Success Accept\n"));
LOCAL_C void MainL()
// add your program code here, example code below
if(aStatus.Int()!=KErrNone) console->Write(_L("Error connecting socket...\n"));
LOCAL_C void DoStartL()
// Create active scheduler (to run active objects)
CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
// Delete active scheduler
Here is piece of code of client and server program: