Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

PROGRAM:

SERVER:

import socket

port=2344

s=socket.socket()

host=socket.gethostname()

s.bind((host,port))

s.listen(1)

c,addr=s.accept()

x=raw_input(“server”)

c.send(bytes(x))

print(c.recv(1024))

c.close()

print(“CONNECTION CLOSED”)

CLIENT:

import socket

s=socket.socket()

host=socket.gethostname()

port=2344

s.connect((host,port))

print(“client waiting”)

s.send(s.recv(1024))

s.close()

print(“CONNECTION CLOSED”)

You might also like