diff --git a/README.md b/README.md index 06b07b7..5d41f7a 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,16 @@ Here i am using caesar cipher to encrpt nbut in reality they Use algotihms lile python end_to_end.py ``` + +### Server And Client +It is simple client server communication script, will add more functionality in future. +```bash +cd server_client +python client.py +python server.py +``` + + ## Release History * 0.0.1 diff --git a/bin/server_client/client.py b/bin/server_client/client.py new file mode 100644 index 0000000..94f2654 --- /dev/null +++ b/bin/server_client/client.py @@ -0,0 +1,16 @@ +import sys +from socket import socket, AF_INET, SOCK_DGRAM, SOL_SOCKET, SO_REUSEADDR + +SERVER_IP = '127.0.0.1' +PORT_NUMBER = 5000 +SIZE = 1024 +print ("Test client sending packets to IP {0}, via port {1}\n".format(SERVER_IP,PORT_NUMBER)) + +mySocket = socket( SOCK_DGRAM ) +mySocket.connect((SERVER_IP,PORT_NUMBER)) + +while True: + data = mySocket.recv(SIZE) + print(data) +sys.exit() +mySocket.close() diff --git a/bin/server_client/server.py b/bin/server_client/server.py new file mode 100644 index 0000000..c02d6c4 --- /dev/null +++ b/bin/server_client/server.py @@ -0,0 +1,14 @@ +from socket import socket, gethostbyname, AF_INET, SOCK_DGRAM, SOL_SOCKET, SO_REUSEADDR +import sys +PORT_NUMBER = 5000 +SIZE = 1024 + +hostName = gethostbyname( 'localhost' ) + +mySocket = socket( SOCK_DGRAM ) +mySocket.bind((hostName, PORT_NUMBER)) +mySocket.listen(1) +while True: + client, addr = mySocket.accept() + data = client.send("Connection Established: ") +sys.exit()