Instead on posting my mile long script here is a short example: I am creating a TCP/IP connection between two computers each running one of the following scripts:
server:
# server.py
import socket
s = socket.socket()
host = socket.gethostname()
port = 1234
s.bind((host, port))
s.listen(5)
while True:
c, addr = s.accept()
print 'Connection from', addr
c.close()
Client:
#client.py
import socket
s = socket.socket()
host = socket.socket()
port = 1234
s.connect((host, port))
print s.recv(1024)
which gives me a ready out like:
Connection from ('19*.1**.0.**', 54451)
Connection from ('19*.1**.0.**', 54452)
Connection from ('19*.1**.0.**', 54453)
Connection from ('19*.1**.0.**', 54454)
What is controlling the creation of the 54451-54454 numbers? I understand what it is; the port number assigned to the client side connection. I just cant seem to figure out how to control the number, or at least the range its issued in.
Is this even possible? Any suggestions would help immensely. Thank you in advance.