mirror of https://github.com/dirtbags/moth.git
pointcli switched to tcp
This commit is contained in:
parent
09d5b1385c
commit
54a19779c3
|
@ -6,9 +6,9 @@ import socket
|
||||||
import time
|
import time
|
||||||
from . import points
|
from . import points
|
||||||
|
|
||||||
def makesock(host):
|
def makesock(host, port=6667):
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
s.connect((host, 6667))
|
s.connect((host, port))
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def submit(cat, team, score, sock=None):
|
def submit(cat, team, score, sock=None):
|
||||||
|
@ -32,11 +32,11 @@ def submit(cat, team, score, sock=None):
|
||||||
# Ignore wrong ID
|
# Ignore wrong ID
|
||||||
continue
|
continue
|
||||||
if txt == 'OK':
|
if txt == 'OK':
|
||||||
|
sock.close()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
raise ValueError(txt)
|
raise ValueError(txt)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
p = optparse.OptionParser(usage='%prog CATEGORY TEAM SCORE')
|
p = optparse.OptionParser(usage='%prog CATEGORY TEAM SCORE')
|
||||||
p.add_option('-s', '--host', dest='host', default='localhost',
|
p.add_option('-s', '--host', dest='host', default='localhost',
|
||||||
|
|
Loading…
Reference in New Issue