Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Multi connection socket server help!
If I have the following:

def Server():

	print("Server....opening port " + str(host) + "  " + str (port))
	sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	serveraddress=(host, port)

	while True:
		clientsocket, clientaddress=sock.accept()
		thread.start_new_thread(Handler, (clientsocket, clientaddress))
The theory in my head says this will accept multiple connections at 'the same time' and pass the input off to the Handler function. Is this correct? Or will this socket be blocked at this point? The Handler function will have one action per instruction received then die..

The blocking confuses me a bit, the other languages I've used don't work quite the same way.

Many thanks.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  socket.gaierror: [Errno 11001] Johnygo 3 136 Aug-07-2019, 02:49 PM
Last Post: Johnygo
  Soft Access Point & Socket Data Streaming groger57 1 138 Aug-01-2019, 02:53 PM
Last Post: groger57
  Send raw string via socket with out any changes john36 18 495 Aug-01-2019, 07:54 AM
Last Post: john36
  Server and Network (socket) [WinError 10053] Timxxx 0 127 Jul-17-2019, 11:50 PM
Last Post: Timxxx
  Python server(Django web site)/client(Python app) connection Junior_Pythoneer 5 258 Jul-05-2019, 05:41 PM
Last Post: noisefloor
  Question concerning function of a a socket pkm 4 1,141 Jun-04-2019, 07:48 AM
Last Post: DeaD_EyE
  socket.gaierror: [Errno -2] Name or service not known seokangwoo99 5 505 May-25-2019, 02:36 PM
Last Post: DeaD_EyE
  Make sockest keep connection LavaCreeperKing 3 272 May-21-2019, 05:05 AM
Last Post: heiner55
  socket programming ConnectionRefusedError error srm 3 364 May-16-2019, 08:07 PM
Last Post: LavaCreeperKing
  Socket reading script Will86 4 412 Apr-17-2019, 06:57 AM
Last Post: Will86

Forum Jump:

Users browsing this thread: 1 Guest(s)