3

Would like to know if explicit action has to be taken in order to close communication sockets used by the socketserver module. I know that server_close() method exists, but as far as I'm aware, it's only meant for the master server socket. Regarding the closing of client sockets, I was thinking something along the lines of:

from socketserver import *
Class MyRequestHandler(StreamRequestHandler):
    def handle(self):
        pass # handle communication
    def finish(self):
        self.request.close() # close communications socket

Is this approach acceptable or is there a better (intended) way of achieving this?

das
  • 41
  • 2

0 Answers0