Skip to content

Commit

Permalink
RServer test code in Python langauge added
Browse files Browse the repository at this point in the history
  • Loading branch information
gauravssnl committed Aug 1, 2020
1 parent 0897fce commit ac7e002
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import socket

def test():
s = socket.socket()
server_address = ("127.0.0.1", 80)
s.connect(server_address)
print("Connected to the server")
request = "GET /test HTTP/1.1\r\n\r\n"
print("Sending request to server:\n", request)
s.sendall(request.encode())
print("Request sent successfullly")
print("Now read response from server")
response = b"";
while True:
data = s.recv(1024)
if data:
response += data
# if data==b"": break
else:
break
print("Response received from server completely:\n", response.decode())


if __name__ == "__main__":
test()

0 comments on commit ac7e002

Please sign in to comment.