Respawn after connection close
This commit is contained in:
parent
154f38f2c0
commit
bc5a551e71
13
src/main.py
13
src/main.py
|
@ -1,6 +1,5 @@
|
||||||
import socket, hashlib
|
import socket, hashlib
|
||||||
# Global variables
|
# Global variables
|
||||||
soc = socket.socket()
|
|
||||||
username = "user" # Edit this to your username, mind the quotes
|
username = "user" # Edit this to your username, mind the quotes
|
||||||
pool_address = "51.15.127.80"
|
pool_address = "51.15.127.80"
|
||||||
pool_port = 2811
|
pool_port = 2811
|
||||||
|
@ -8,6 +7,8 @@ pool_port = 2811
|
||||||
print("Starting 3DS Miner, you probably will get Output on an error.")
|
print("Starting 3DS Miner, you probably will get Output on an error.")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
try:
|
||||||
|
soc = socket.socket()
|
||||||
soc.connect((str(pool_address), int(pool_port))) # Connect to the server
|
soc.connect((str(pool_address), int(pool_port))) # Connect to the server
|
||||||
server_version = soc.recv(3).decode() # Get server version
|
server_version = soc.recv(3).decode() # Get server version
|
||||||
print("Server is on version", server_version)
|
print("Server is on version", server_version)
|
||||||
|
@ -18,7 +19,7 @@ while True:
|
||||||
|
|
||||||
# Don't mind the "ESP32" for now since it is in an early state
|
# Don't mind the "ESP32" for now since it is in an early state
|
||||||
|
|
||||||
job = soc.recv(87).decode() # Get work from pool
|
job = soc.recv(100).decode() # Get work from pool
|
||||||
job = job.split(",") # Split received data to job (job and difficulty)
|
job = job.split(",") # Split received data to job (job and difficulty)
|
||||||
difficulty = job[2]
|
difficulty = job[2]
|
||||||
for result in range(
|
for result in range(
|
||||||
|
@ -34,12 +35,6 @@ while True:
|
||||||
feedback = soc.recv(1024).decode() # Get feedback about the result
|
feedback = soc.recv(1024).decode() # Get feedback about the result
|
||||||
print(feedback)
|
print(feedback)
|
||||||
except:
|
except:
|
||||||
while True:
|
break
|
||||||
try:
|
|
||||||
soc.close()
|
|
||||||
soc = socket.socket()
|
|
||||||
soc.connect((str(pool_address), int(pool_port))) # Connect to the server
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
else:
|
|
||||||
break
|
|
||||||
|
|
Loading…
Reference in New Issue