Skip to content

Commit

Permalink
beta版完成
Browse files Browse the repository at this point in the history
  • Loading branch information
nekosaburo8250 committed Oct 14, 2017
1 parent 9116b69 commit 1e810ba
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"ExpandedNodes": [
""
],
"SelectedNode": "\\syokudou_client.py",
"SelectedNode": "\\shokudo_client.py",
"PreviewInSolutionExplorer": false
}
Binary file modified .vs/slnx.sqlite
Binary file not shown.
Binary file modified .vs/syokudou/v15/.suo
Binary file not shown.
5 changes: 5 additions & 0 deletions log.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
2017-10-14 18:38:25.532174,116309
2017-10-14 18:40:33.116065,116309
2017-10-14 18:42:03.388296,116309
2017-10-14 18:44:46.332086,116309
2017-10-14 18:45:23.859918,116309
20 changes: 10 additions & 10 deletions shokudo_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
import sys


string=""
message={
b"SUCCEEDED":"ご利用ありがとうございます。",
b"INVALID_ID":"不正な学籍番号です。",
b"DUPLICATED":"多重利用です。"
}

def onEVT_TEXT_ENTER(evt):
try:
student_id=textbox.GetValue()
if not student_id:
return
sock=socket.socket()
sock.connect(("192.168.11.8",55555))
#sock.connect(("192.168.11.8",55555))
sock.connect(("localhost",55555))
sock.sendall(student_id.encode())
error_code=sock.recv(1024).decode()
if error_code=="0":
message_label_text.SetLabel("ご利用ありがとうございます。")
elif error_code=="1":
message_label_text.SetLabel("不正な学籍番号です。")
elif error_code=="2":
message_label_text.SetLabel("多重利用です。")
error_code=sock.recv(1024)

message_label_text.SetLabel(message[error_code])
textbox.Clear()

except ConnectionResetError:
Expand All @@ -32,7 +32,7 @@ def onEVT_TEXT_ENTER(evt):
#TODO:BaseException必須?
print(ex+"原因不明の例外です.")


app=wx.App()
frame=wx.Frame(None)

Expand Down
8 changes: 5 additions & 3 deletions shokudo_server.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#TODO:停電対策(耐障害)

from enum import Enum
import socket
import re
import csv
import datetime


customers=[]

Expand All @@ -19,12 +21,12 @@
print(student_id)
if re.match(r"\d{6}$",student_id):
if student_id in customers:
client_sock.sendall(b"2")
client_sock.sendall(b"DUPLICATED")
else:
customers.append(student_id)
client_sock.sendall(b"0")
client_sock.sendall(b"SUCCEEDED")
else:
client_sock.sendall(b"1")
client_sock.sendall(b"INVALID_ID")
except ConnectionResetError:
print("接続が切断されました.LANケーブル,ハブの電源を確認して下さい.")
except BaseException as ex:
Expand Down

0 comments on commit 1e810ba

Please sign in to comment.