Re: TCP server stop receiving new connections

Tech-Archive recommends: Fix windows errors by optimizing your registry



Are you saying that you destroy your listening socket?

BTW, I'd also advise against using MFC sockets. And on
top of that, MFC only supports async socket model which
is not suitable for a server.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://vcfaq.mvps.org
=====================================

"Julián Rodríguez Bajo" <julian.rodriguez@xxxxxxxxxx> wrote in message
news:uYGtXpSxHHA.2132@xxxxxxxxxxxxxxxxxxxxxxx
Alexander Nickolov escribió:
What do you do in your OnAccept handler? In particular,
do you try to accept multiple sockets? A test to try is to
reset the event mask of your listening socket each time you
exit its OnAccept handler.

Also, as a reality check - make sure your message loop
never gets stuck... E.g. when you break into the debugger,
almost always you should end up in the message loop.


Hi Alexander.

In OnAccept I just accept one incomming connection, since as documentation
of WSAAsyncSelect says, FD_ACCEPT is posted after an accept call if there
is another connection request available to accept. BTW, I have tested with
a loop in OnAccept handler to accept all pending connection requests and
behaviour did not change.

The problem is that OnAccept handler is not called for a long time (maybe
1, 2 or even 5 minutes).

OTOH, the first time I open the server socket, everything works fine, even
if there are 50 clients running trying to connect to the server before I
start the server. But after a shutdown/close/create/listen sequence the
problem appears. Maybe has something to do with the Socket Notification
Window creation/destruction by MFC framework?

Regards.



.



Relevant Pages

  • Re: TCP server stop receiving new connections
    ... I have tested with a loop in OnAccept handler to accept all pending ... OTOH, the first time I open the server socket, everything works fine, ... Notification Window creation/destruction by MFC framework? ...
    (microsoft.public.win32.programmer.networks)
  • Re: TCP server stop receiving new connections
    ... In OnAccept I just accept one incomming connection, since as documentation of WSAAsyncSelect says, FD_ACCEPT is posted after an accept call if there is another connection request available to accept. ... I have tested with a loop in OnAccept handler to accept all pending connection requests and behaviour did not change. ... OTOH, the first time I open the server socket, everything works fine, even if there are 50 clients running trying to connect to the server before I start the server. ...
    (microsoft.public.win32.programmer.networks)
  • Re: how to start a project
    ... For your server you should probably start with Win32 Console application as ... For a Windows GUI program you could use ... MFC is pretty old technology. ... Create a socket. ...
    (microsoft.public.win32.programmer.networks)
  • Re: CAsyncsocket Attach and detach
    ... DLLs (of which the MFC and CRT runtimes are two of a couple dozen) and makes sure they are ... You can create installer files in VS.NET so there's no cost for a third-party ... I use CAsyncSocket to accept in OnAccept, detach the socket and set it ...
    (microsoft.public.vc.mfc)
  • Re: Difference between Windows Sockets and Windows sockets in MFC
    ... MFC uses the async socket model only. ... CSocket class contains a modal message loop to achieve blocking ...
    (microsoft.public.win32.programmer.networks)