Skip to content

Commit

Permalink
Python code for server in server_client program
Browse files Browse the repository at this point in the history
basic sever program
  • Loading branch information
mukund26 authored Oct 12, 2017
1 parent 5b47dec commit 9d4ed74
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /usr/bin/python
import socket
host="127.0.0.1"
port=12345
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind((host,port))
s.listen(1)

while True:
conn,addr=s.accept()
print("Connected by:",addr)
data=conn.recv(1024)
if not data: break
a=[int(i) for i in data.split(' ')]
k=a[0]+a[1]
k=str(k)
conn.sendall(k)
conn.close

0 comments on commit 9d4ed74

Please sign in to comment.