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

Adding parameter to funciton server_conn

parent ed4977d6
No related branches found
No related tags found
1 merge request!2WIP - 001 - addingserver
#authors : Ismail MOUMNI
#authors : Julien David & Ismail MOUMNI
import socket
# SERVER PORT
Port = 9393
# Creating Socket IP4 TCP
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
#BINDING
serv.bind(('127.0.0.1',Port))
# Listening to 1 CLient
serv.listen()
#accepting the connection from client and getting client IP
conn, addr = serv.accept()
def server_conn(address):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
#BINDING
serv.bind((address,Port))
# Listening to 1 CLient
serv.listen()
#accepting the connection from client and getting client IP
conn, addr = serv.accept()
with conn:
# Sending
conn.send(bytes("Bonjour !!","utf-8"))
print('CLIENT IP ADDRESS : ',addr)
print('Connexion acceptée depuis l IP : ',addr)
# Receiving Data from Client
data = conn.recv(1024)
print(data)
......
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