[Libwebsockets] Multiple Client Connections

Andy Green andy at warmcat.com
Wed Dec 9 10:34:16 CET 2015

On December 9, 2015 4:47:58 PM GMT+08:00, shyam goyal <shyam_iisc at yahoo.com> wrote:
>I am setting up multiple client connections to server at a time. Each
>connection is having a separate service loop running in a separate
>thread. Connection is closed when service loop returns -1. Sometime it
>takes a couple of minute after callback method returns -1 and
>socket_destroyed notification is received by the client. On receiving
>this notification I shut down the service loop.

It's probably worth looking at today's changes to the test client.

He has multiple client connections in one service loop, I'm not sure if you have other reasons for making multiple service threads but if not, you don't have to do that.  And he responds to the peer going away immediately.

>I am seeing a strange behaviour when a connection is closed by my
>application and before receiving 'socket_destroyed' notification,
>application goes on creating an another connection. The new connection
>is set up properly most of the time but not always and I never get
>'socket_destroyed' notification for first connection. I am doing some
>clean up on receiving this notification so things never cleaned up for
>first connection and service loop keep running for ever.

I dunno but one thing to notice is only the protocols[0] callback gets some notifications like client connect failure.

It's a lot easier if you can compare how the test client, or a patched test client, acts under similar conditions because then I can try to reproduce the problem using that rather than have to use my crystal ball.


>Please suggest me some idea to resolve this. Regards: Shyam Sunder
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org

More information about the Libwebsockets mailing list