I am entering the Symbian world of programming from the Windows world and had a some questions about the use of the Accept() call in the RSocket class that is available in the SDK.

There has been a lot of posts on similar messages - socket server, but have not seen consistent replies to any of these. Some on the forum also said that they had problems with Connect() API rather than Accept() API.

OK coming to the point, these are the steps I am using the following in the Series 60 Emulator:

================ Code Start ======================

Derive a socketworker class from the CActive class.
Along the initialization, have this

// Adding the object to the AS

// Open channel to Socket Server service provider

// In the listen function have this code
_LIT(KTCP, "tcp");

TProtocolDesc desc;

// Find the support for TCP protocol
User::LeaveIfError(iSocketServ.FindProtocol((const TDesC&) KTCP, desc));

// OPen the Listening socket
User::LeaveIfError(iListener.Open( iSocketServ , desc.iAddrFamily , desc.iSockType ,

// Initialize the address to bind and listen on
TInetAddr anyAddrOnPort(KInetAddrAny, 1740);

// Bind the socket to the address
TInt bindStat = iListener.Bind(anyAddrOnPort);

// Listening for socket connections
TUint queSize = 5;
TUint popConn;

popConn = iListener.Listen(queSize);

RSocket acceptSock;

// Open the accept sock as a blank socket to be paired later

// TRequestStatus reqStat defined in the header;

// Accept and block for the incoming call
iListener.Accept(blankRSock, reqStat);

********************** Comments Start ****************

Hey! Wait a Minute - Accept is an asynchronous call - right?

This is where I have seen different approaches going ahead from here - to implement blocking or to use the asynchnous behavior.

I guess the blocking approach is recommended for apps that have the accept call in a thread other than the main thread.

I am using the asynchronous behavior is used wherein the RunL function will be called when a client attempts to Connect() to this server.

I call the SetActive() function as shown below.

******************** Comments End *******************


==================== Code End ===================

So, I believe from all the documentation and posts on this forum that I have read, I have a socket server application listening for incoming connections

But there is a small problem, ... this server DOES NOT accept any connections.

When I connect from a client application from Windows, on the client side, connect() fails with error WSAECONNREFUSED (10061) - is the server even listening?

On the server side, do not get any callback into the RunL function.

There are some people who have mentioned that the Accept() call from the RSocket class has worked for them and am hoping that someone on this list can point out something that I am missing.

I have seen an application called SmallServ penned by a Symbian Staff but for the Series 90 platform. The application did not build with the Series 60 environment.

All help is appreciated.