Poulet
This commit is contained in:
parent
fb9f95aa26
commit
bb72fdcc9a
@ -55,8 +55,8 @@ class start(QtGui.QDialog):
|
||||
exit(0)
|
||||
try:
|
||||
self.s.send(cmd.encode())
|
||||
# data , addr = s.recvfrom(4096)
|
||||
# print(data.decode())
|
||||
data = self.s.recv(4096)
|
||||
print(data.decode())
|
||||
except timeout:
|
||||
print("Erreur : Timeout. Le serveur ne repond pas.")
|
||||
|
||||
|
@ -6,7 +6,7 @@ from serveur import Log
|
||||
|
||||
|
||||
def handleConnection(connection, client_address) :
|
||||
try:
|
||||
#try:
|
||||
log.printL("Connection from IP -> {}".format(client_address), Log.lvl.INFO)
|
||||
while True:
|
||||
data = connection.recv(4096)
|
||||
@ -16,12 +16,12 @@ def handleConnection(connection, client_address) :
|
||||
threading.Thread(target=handleRequest, args=(connection, data.decode())).start()
|
||||
else:
|
||||
break
|
||||
except Exception as e :
|
||||
log.printL(str(e), Log.lvl.FAIL)
|
||||
"""except Exception as e :
|
||||
log.printL(str(e), Log.lvl.FAIL)"""
|
||||
|
||||
|
||||
def handleRequest(connection, data):
|
||||
try:
|
||||
#try:
|
||||
arrayData = data.split(" ")
|
||||
if(not arrayData[0][0] == "/"):
|
||||
broadcastMsg( "NEW_MSG {} {} ".format(usersConnected[connection][1], data))
|
||||
@ -46,12 +46,13 @@ def handleRequest(connection, data):
|
||||
privateMsg(connection,arrayData[1],arrayData[2:])
|
||||
return
|
||||
connection.send("ERR_COMMAND_NOT_FOUND".encode())
|
||||
except Exception as e :
|
||||
log.printL(str(e), Log.lvl.FAIL)
|
||||
"""except Exception as e :
|
||||
log.printL(str(e), Log.lvl.FAIL)"""
|
||||
|
||||
|
||||
def broadcastMsg(message):
|
||||
sock.sendall(message.encode())
|
||||
for con, value in usersConnected.items() :
|
||||
con.send(message.encode())
|
||||
|
||||
|
||||
def userListActive(connection):
|
||||
@ -132,11 +133,11 @@ def privateMsg(connection, pseudo, msg):
|
||||
|
||||
|
||||
def quit(connection) :
|
||||
broadcastMsg("HAS_LEFT {}".format(usersConnected[connection][1]))
|
||||
connection.send("SUCCESSFUL_LOGOUT".encode())
|
||||
connection.close()
|
||||
usersConnected.__delitem__(connection)
|
||||
log.printL("Disconnection from IP -> {}".format(usersConnected[connection][0]), Log.lvl.INFO)
|
||||
usersConnected.pop(connection)
|
||||
broadcastMsg("HAS_LEFT {}".format(usersConnected[connection][1]))
|
||||
|
||||
|
||||
def getConnectionByPseudo(pseudo):
|
||||
|
Reference in New Issue
Block a user