Skip to content

socketserver's TCPServer documentation only presents case of single request per connection #112020

Closed
@talcs

Description

@talcs

Documentation

The TCPServer examples here suggest that the BaseRequestHandler.handle method should call self.request.recv just once, and return, which closes the socket immediately, forcing the client to create a new socket and reconnect for every single request.

I think there should be at least one example where the handle method keeps running until the client hangs, which can be indicated when recv's returned value has a length of 0, which by the way, should be covered in the socket.recv documentation. The meaning of 0 as a returned value of socket.recv is covered in the C API docs.

Sample code that allows multiple requests using the same connection can be seen here.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions