Skip to content
Snippets Groups Projects
Commit 02cc2119 authored by Ismail Moumni's avatar Ismail Moumni
Browse files

Adding Server

parent f3f952c5
No related branches found
No related tags found
1 merge request!2WIP - 001 - addingserver
......@@ -2,11 +2,11 @@
import socket
# SERVER PORT
Port = 9399
Port = 9393
# Creating Socket IP4 TCP
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
#BINDING
serv.bind(('',Port))
serv.bind(('127.0.0.1',Port))
# Listening to 1 CLient
serv.listen()
#accepting the connection from client and getting client IP
......@@ -14,10 +14,10 @@ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
with conn:
# Sending
conn.send('Bonjour')
conn.send(bytes("Bonjour !!","utf-8"))
print('CLIENT IP ADDRESS : ',addr)
# Receiving Data from Client
data = conn.recv(1024)
print(data)
serv.close()
serv.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment