Re: TCP server stop receiving new connections



On Jul 10, 4:34 pm, Julián Rodríguez Bajo
<julian.rodrig...@xxxxxxxxxx> wrote:
Ali escribió:



On Jul 9, 1:06 am, Julián Rodríguez Bajo <julian.rodrig...@xxxxxxxxxx>
wrote:
Hi folks.

I have a strange problem in my class library used by all our client and
server applications.

There are servers listening on different ports for different purposes.
Sometimes (when a lot of new clients try to connect to the same server),
one of the servers (not allways the same one) stops accepting new
incomming connections, but keeps current connections. Server port
appears as LISTENING, but OnAccept never arrives to server. New client
connections receive a WSAECONNREFUSED error. In this situation, if I
call Accept directly in a test application, one incomming connection is
accepted, but no messages can be sent cliet -> server nor server ->
client, and after 15 seconds connection is dropped because of a custom
keep alive mechanism. Running server and a lot of client applications in
same machine fails the same way.

Both client and server processes use the same class library. The library
is a statically linked MFC based static library. Both classes, server
and client, derive from CAsyncSocket. There are no threads involved.

I have tried changing nConnectionBacklog parameter to Listen, but that
does not seems to make any effect.

Any suggestion would be apreciated.

Best regards.

--snip--
Both classes, server and client, derive from CAsyncSocket. There are no threads involved.

If you are not using threads fro non-blocked sockets then how you
honour the requests from multiple clients?

ali

When a CAsyncSocket derived socket is created, by default a
WSAAsyncSelect is called with FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT |
FD_CONNECT | FD_CLOSE event notification mask. Every socket notification
is received in an WM_SOCKET_NOTIFY message. MFC dispatches every socket
notification to the corresponding virtual method of the CAsyncSocket object:

* FD_READ --> Calls OnReceive function.
* FD_WRITE --> Calls OnSend function.
* FD_OOB --> Calls OnOutOfBandData function.
* FD_ACCEPT --> Calls OnAccept function.
* FD_CONNECT --> Calls OnConnect function.
* FD_CLOSE --> Calls OnClose function.

So, there is no need to use multiple threads to serve multiple clients.

Hmm, sounds good to me. Your architecture looks good and quite natural
BUT it seems you need to tweak with your MFC message pump. Anyway, you
can write a simple hook for WM_SOCKET_NOTIFY message to double check
your network part interface.


ali


ali

.



Relevant Pages

  • Re: Network intermittently dropping the connection to shared files on server
    ... what we were using with our SBS2000 server with no problems. ... It's a small Server plus 4 Client W/S set up in one office. ... All users that have current connections to the shared files are ... We have a small network < 5 clients connected to a new Dell ...
    (microsoft.public.windows.server.sbs)
  • Re: What doesnt lend itself to OO?
    ... >> proxy and instructs the server to constuct the real object. ... rather than client code. ... If 'clock' is instantiated in the server, ... > for the server interface at the OOA level. ...
    (comp.object)
  • This is going straight to the pool room
    ... or not the client has privilege to do what they're trying to do, ... The server environment is this: ... 3GL User action Routines that Tier3 will execute on your behalf during the ... Routine Name: USER_INIT ...
    (comp.os.vms)
  • Re: TCP server stop receiving new connections
    ... reset the event mask of your listening socket each time you ... I have a strange problem in my class library used by all our client ... server applications. ... incomming connections, but keeps current connections. ...
    (microsoft.public.win32.programmer.networks)
  • [Full-Disclosure] R: Full-Disclosure Digest, Vol 3, Issue 42
    ... Full-Disclosure Digest, Vol 3, Issue 42 ... SD Server 4.0.70 Directory Traversal Bug ... Arkeia Network Backup Client Remote Access ...
    (Full-Disclosure)

Loading