materials icon indicating copy to clipboard operation
materials copied to clipboard

Sockets of multi connect server's client do not close on minor change from eco server to normal server and normal client

Open ganeshkbhat opened this issue 3 years ago • 0 comments

:information_source: After I use it (https://github.com/realpython/materials/blob/master/python-sockets-tutorial/multiconn-client.py) with a small change (minor change from echo server to normal server) -

- after sending and receiving messages from the client and server, the client does not close; or
- all data.messages have been exausted, the client does not close.

https://stackoverflow.com/questions/70640602/sockets-in-python-client-not-closing-after-event-read-write-events-in-multi-conn

You can report issues and problems here, but we typically won't be able to provide 1:1 support outside the channels listed above.

Describe the bug After minor change from echo server to normal server:

- after sending and receiving messages from the client and server, the client does not close; or
- all data.messages have been exausted, the client does not close.

To Reproduce Provided in the stackoverflow question

Expected behavior The client should close. Looks like it does not get into the if not recv_data code while I was checking. The program should reach the code. No major changes to the code has been made other than sending data from messages section. :

if not recv_data:
    print("closing connection", data.connid)
    sel.unregister(sock)
    sock.close()

Screenshots Added to link: https://stackoverflow.com/questions/70640602/sockets-in-python-client-not-closing-after-event-read-write-events-in-multi-conn

Desktop (please complete the following information):

  • OS: [e.g. iOS] Win, Linux

Additional context NA

ganeshkbhat avatar Jan 10 '22 03:01 ganeshkbhat