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
  Python script multi client server sonra 1 226 Mar-24-2020, 03:49 PM
Last Post: Larz60+
  Writing socket server NewPy_thwan_Programmer 0 269 Feb-23-2020, 03:58 PM
Last Post: NewPy_thwan_Programmer
  Server and Network (socket) [WinError 10053] Timxxx 1 860 Aug-23-2019, 10:03 AM
Last Post: iMuny
  Python server(Django web site)/client(Python app) connection Junior_Pythoneer 5 690 Jul-05-2019, 05:41 PM
Last Post: noisefloor
  Server and Network (socket) [WinError 10053] SheeppOSU 2 5,214 Apr-13-2019, 09:23 PM
Last Post: SheeppOSU
  Async socket server and ports Pengwyn 1 1,264 Feb-28-2019, 12:13 AM
Last Post: DeaD_EyE
  tcp server/client port connection issue valshev 2 2,645 Sep-01-2018, 02:50 PM
Last Post: valshev
  Send data BMP180 between client and server trought module socket smalhao 0 960 Jul-30-2018, 12:56 PM
Last Post: smalhao
  WebRTC connection from the server Borisko 1 2,137 May-20-2018, 10:15 AM
Last Post: Borisko
  Python // C # - SOCKET connection is constantly interrupted raspberryPiBRA 0 1,054 Feb-01-2018, 09:53 AM
Last Post: raspberryPiBRA

Forum Jump:

Users browsing this thread: 1 Guest(s)