#server side import socket print ("Server Up") s = socket.socket() port = PA # PA = Port Address s.bind(('', port)) s.listen(1) c, addr = s.accept() print ("Socket Up and running with a connection from Client at ",addr) while True: rcvdData = c.recv(1024).decode() print ("Client:",rcvdData) sendData = input("Server: ") c.send(sendData.encode()) if(sendData == "Bye" or sendData == "bye"): break c.close() #client side import socket print ("Client Up") s = socket.socket() s.connect(('LA', PA)) # LA = loop Address; PA = Port Address while True: str = input("Client: ") s.send(str.encode()); if(str == "Bye" or str == "bye"): break print ("Server:",s.recv(1024).decode()) s.close() based on the code given,need to know what need to fill in the code given and provide the output result
#server side
import socket
print ("Server Up")
s = socket.socket()
port = PA # PA = Port Address
s.bind(('', port))
s.listen(1)
c, addr = s.accept()
print ("Socket Up and running with a connection from Client at ",addr)
while True:
rcvdData = c.recv(1024).decode()
print ("Client:",rcvdData)
sendData = input("Server: ")
c.send(sendData.encode())
if(sendData == "Bye" or sendData == "bye"):
break
c.close()
#client side
import socket
print ("Client Up")
s = socket.socket()
s.connect(('LA', PA)) # LA = loop Address; PA = Port Address
while True:
str = input("Client: ")
s.send(str.encode());
if(str == "Bye" or str == "bye"):
break
print ("Server:",s.recv(1024).decode())
s.close()
based on the code given,need to know what need to fill in the code given and provide the output result
Step by step
Solved in 3 steps
After i run the server side code it just print server up.After that i run the client side it out this message
Client Up
Traceback (most recent call last):
File "C:\Users\User\Downloads\p.py", line 4, in <module>
s.connect(('localhost', 8000)) # LA = loop Address; PA = Port Address
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
what need to do to get the actual output?