Bottom Page

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

def Server():

	host='0,0,0,0'
	port=12345
	print("Server....opening port " + str(host) + "  " + str (port))
	sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	serveraddress=(host, port)
	sock.bind(serveraddress)
	sock.listen(200)

	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.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Server and Network (socket) [WinError 10053] Timxxx 1 298 Aug-23-2019, 10:03 AM
Last Post: iMuny
  Python server(Django web site)/client(Python app) connection Junior_Pythoneer 5 344 Jul-05-2019, 05:41 PM
Last Post: noisefloor
  Server and Network (socket) [WinError 10053] SheeppOSU 2 1,071 Apr-13-2019, 09:23 PM
Last Post: SheeppOSU
  Async socket server and ports Pengwyn 1 567 Feb-28-2019, 12:13 AM
Last Post: DeaD_EyE
  tcp server/client port connection issue valshev 2 1,806 Sep-01-2018, 02:50 PM
Last Post: valshev
  Send data BMP180 between client and server trought module socket smalhao 0 709 Jul-30-2018, 12:56 PM
Last Post: smalhao
  WebRTC connection from the server Borisko 1 1,657 May-20-2018, 10:15 AM
Last Post: Borisko
  Python // C # - SOCKET connection is constantly interrupted raspberryPiBRA 0 871 Feb-01-2018, 09:53 AM
Last Post: raspberryPiBRA
  socket server with SSL accepting unencrypted data kopite 0 1,225 Apr-20-2017, 08:31 AM
Last Post: kopite
  socket server help abrew132 1 1,710 Apr-20-2017, 03:02 AM
Last Post: Skaperen

Forum Jump:


Users browsing this thread: 1 Guest(s)