the default port to avoid multiple opening for same crate at same computer is 4300 + IP

This commit is contained in:
Ryan Tang 2024-10-21 16:26:18 -04:00
parent a187e31d1c
commit 2bdd7deb41

View File

@ -21,20 +21,12 @@ except:
token = None # Or assign a default value if needed
org = "FSUFoxLab"
ip = "https://fsunuc.physics.fsu.edu/influx/"
# databaseIP="128.186.111.107"
databaseIP=ip
databaseIP="https://fsunuc.physics.fsu.edu/influx/"
write_client = influxdb_client.InfluxDBClient(url=databaseIP, token=token, org=org)
bucket = "ISEG"
# write_api = write_client.write_api(write_options=ASYNCHRONOUS)
write_api = write_client.write_api(write_options=SYNCHRONOUS)
#assign a port, to prevent the script run mulitple time
s = socket.socket()
host = socket.gethostname()
port = 4305
s.bind((host,port))
nArg = len(sys.argv)
if nArg > 1 :
@ -47,6 +39,14 @@ else :
pushToDB = False
#============== assign a port, to prevent the script run mulitple time
s = socket.socket()
host = socket.gethostname()
port = 4300 + int(IP[-3:])
print("using port " + str(port))
s.bind((host,port))
#===================== GUI
mpod = iseg.Mpod(IP)