Assignment_2
Assignment_2
SOCKET PROGRAMMING
Implement echo client-server message passing application. Messages sent from the client should
1. Write a server (TCP) C Program that opens a listening socket and waits to serve clients.
2. Write a client (TCP) C Program that connects with the server program knowing IP
3. Get the input string from console on client and send it to server, server displays the same
String.
1) import socket
s = socket.socket()
print("socket created")
s.bind(('127.0.0.1', 8888))
s.listen(3)
print('waiting for conncetions')
c, addr = s.accept()
print("connedted with ", addr)
while True:
rec = c.recv(1024).decode()
print(rec)
message = input("message from server side to client side: ")
c.send(bytes(message, 'utf-8'))
if message == '0' or rec == '0':
c.close()
break
2) import socket
c = socket.socket() #
c.connect(('127.0.0.1', 8888))
name = '1'
while True:
print(rec)
3)
3)
HTTP
HTTP HTTPS
1) In HTTP, URL begins with http://. 1) In HTTPs, URL starts with https://.
2) HTTP uses port number 80 for 2) HTTPs uses 443 port number for
communication communication.
2. Write down the steps to capture HTTP request packets for the
following URL.
URL: http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-
file2.html
1)Open Wireshark
2)Click on capture
3)You'll want to capture traffic that goes through your ethernet driver.
click on the start button to capture traffic via this interface.
4) Visit the URL that you wanted to capture the traffic from.
5) Go back to your Wireshark screen and press capture button to stop
capturing.
6) After the traffic capture is stopped, please save the captured traffic
and analyze the packet.
IP of server : 128.119.245.12
Ans: en-US,en;q=0.9
d) What is the status code returned from the server to your browser?
Ans: Status Code: 200 / [Status Code Description: OK] / Response Phrase:
OK
h) Did you receive the content of the file if you requested the same
HTML file?
That will only be sent once by the server due to the inclusion of the IN-
MODIFIED-SINCE<br>\n
DNS
Ans: Tcp
2. What is the destination port of the DNS query and source port of the
DNS response?
Ans: 192.168.167.178