realpython / realpython/materials

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

Đang mở
#241 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Jupyter Notebook
Star
5.2k
Fork
5.3k
Merge trung bình
4 ngày 10 giờ
Pull request đã merge (30 ngày)
10

Mô tả

ℹ️
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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với python-sockets-tutorial/multiconn-client.py và bản tái hiện Stack Overflow được liên kết; so sánh thay đổi của echo-server với luồng normal-server được mô tả. Xác nhận rằng sau khi các thông báo đã được xử lý hết, client đi đến nhánh if not recv_data được hiển thị và đóng lại. Hoàn thành có nghĩa là client đóng một cách đáng tin cậy trong cả hai trường hợp được mô tả.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
networking
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.