diff --git a/SwichGIT/ServerPyt/.idea/ServerPyt.iml b/SwichGIT/ServerPyt/.idea/ServerPyt.iml
new file mode 100644
index 0000000..d0876a7
--- /dev/null
+++ b/SwichGIT/ServerPyt/.idea/ServerPyt.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SwichGIT/ServerPyt/.idea/inspectionProfiles/Project_Default.xml b/SwichGIT/ServerPyt/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..40985a1
--- /dev/null
+++ b/SwichGIT/ServerPyt/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SwichGIT/ServerPyt/.idea/inspectionProfiles/profiles_settings.xml b/SwichGIT/ServerPyt/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/SwichGIT/ServerPyt/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SwichGIT/ServerPyt/.idea/misc.xml b/SwichGIT/ServerPyt/.idea/misc.xml
new file mode 100644
index 0000000..d1e22ec
--- /dev/null
+++ b/SwichGIT/ServerPyt/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/SwichGIT/ServerPyt/.idea/modules.xml b/SwichGIT/ServerPyt/.idea/modules.xml
new file mode 100644
index 0000000..e5fbddf
--- /dev/null
+++ b/SwichGIT/ServerPyt/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SwichGIT/ServerPyt/.idea/vcs.xml b/SwichGIT/ServerPyt/.idea/vcs.xml
new file mode 100644
index 0000000..6c0b863
--- /dev/null
+++ b/SwichGIT/ServerPyt/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SwichGIT/ServerPyt/.idea/workspace.xml b/SwichGIT/ServerPyt/.idea/workspace.xml
new file mode 100644
index 0000000..b52d1c3
--- /dev/null
+++ b/SwichGIT/ServerPyt/.idea/workspace.xml
@@ -0,0 +1,140 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1605462744659
+
+
+ 1605462744659
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SwichGIT/ServerPyt/client.py b/SwichGIT/ServerPyt/client.py
new file mode 100644
index 0000000..6fb53fd
--- /dev/null
+++ b/SwichGIT/ServerPyt/client.py
@@ -0,0 +1,40 @@
+import socket
+import threading
+
+class Client:
+ def __init__(self):
+ self.create_connection()
+
+ def create_connection(self):
+ self.s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
+
+ while 1:
+ try:
+ host = input("Entrez l'adresse IP de l'Host : ")
+ port = int(input("Entrez le port : "))
+ self.s.connect((host,port))
+
+ break
+ except:
+ print("Impossible de se connecter au serveur")
+
+ self.username = input('Entrez votre pseudo : ')
+ self.s.send(self.username.encode())
+
+ message_handler = threading.Thread(target=self.handle_messages,args=())
+ message_handler.start()
+
+ input_handler = threading.Thread(target=self.input_handler,args=())
+ input_handler.start()
+
+ def handle_messages(self):
+ while 1:
+ print(self.s.recv(1204).decode())
+ print("")
+
+ def input_handler(self):
+ while 1:
+ print("Message : ",end='')
+ self.s.send((self.username+' - '+input()).encode())
+
+client = Client()
diff --git a/SwichGIT/ServerPyt/server.py b/SwichGIT/ServerPyt/server.py
new file mode 100644
index 0000000..93cd8ac
--- /dev/null
+++ b/SwichGIT/ServerPyt/server.py
@@ -0,0 +1,62 @@
+import socket
+import threading
+
+class Server:
+ def __init__(self):
+ self.start_server()
+
+ def start_server(self):
+ self.s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
+
+ host = socket.gethostbyname(socket.gethostname())
+ port = int(input("Entrez le port sur lequel le serveur va être : "))
+
+ self.clients = []
+
+ self.s.bind((host,port))
+ self.s.listen(100)
+
+ print("Ip de l'host "+str(host))
+ print('Marche sur le port '+str(port))
+
+ self.username_lookup = {}
+
+ while True:
+ c, addr = self.s.accept()
+
+ username = c.recv(1024).decode()
+
+ print('Nouvelle connection : Pseudo '+str(username))
+ self.broadcast('Nouvelle personne à rejoind : Pseudo '+username)
+
+ self.username_lookup[c] = username
+
+ self.clients.append(c)
+
+ threading.Thread(target=self.handle_client,args=(c,addr,)).start()
+
+ def broadcast(self,msg):
+ for connection in self.clients:
+ connection.send(msg.encode())
+
+ def handle_client(self,c,addr):
+ while True:
+ try:
+ msg = c.recv(1024)
+ except:
+ c.shutdown(socket.SHUT_RDWR)
+ self.clients.remove(c)
+
+ print(str(self.username_lookup[c])+' est parti')
+ self.broadcast(str(self.username_lookup[c])+' a quite')
+
+ break
+
+ if msg.decode() != '':
+ print(str(msg.decode()))
+ for connection in self.clients:
+ if connection != c:
+ connection.send(msg)
+
+
+server = Server()