Answered step by step
Verified Expert Solution
Question
1 Approved Answer
this is my webclient.py this is my webserver.py I keep running it but none of the information will show up when I run wireshark. Is
this is my webclient.py
this is my webserver.py
I keep running it but none of the information will show up when I run wireshark. Is something wrong with my code?
This is what I'm supposed to create.
1 from socket import * # Import socket module 2 import sys, os, errno 3 import time 4 5 6 7 # Create a TCP server socket #(AF_INET is used for IPv4 protocols) #(SOCK_STREAM is used for TCP) 8 9 clientSocket = socket (AF_INET, SOCK_STREAM) 10 11 12 # Assign a port number # serverPort = 6789 13 14 if len(sys.argv) < 4: 15 16 17 18 " print("Usage: python3 + sys.argv[0] + serverAddr serverPort filename") sys.exit(1) serverAddr = sys.argv[1] serverPort = int(sys.argv[2]) 19 fileName = sys.argv[3] 20 21 # Connect to the server 22 try: 23 24 25 26 27 28 29 sys.exit(1) clientSocket.connect((serverAddr, serverPort)) receive_buffer_size = 4098 clientSocket.setsockopt(SOL_SOCKET, SO_RCVBUF, receive_buffer_size) except error as e: 11 print("Connection to server failed. + str(e)) 30 print('------The client is ready to send- -') print(str(clientSocket.getsockname()) + -->' + str(clientSocket.getpeername())) 31 32 33 try: 34 35 36 getRequest = "GET /" + fileName + HTTP/1.1 Host: + serverAddr + " " getRequest = getRequest + "Accept: text/html Connection: keep-alive " clientSocket.send(getRequest.encode()) 37
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started