# Sunucu
from socket import *
import sys
serverSocket = socket(AF_INET, SOCK_STREAM)
serverPort = 100
serverSocket.bind(('',serverPort)) belirtmektedir.
serverSocket.listen(1)
while True:
connectionSocket,addr = serverSocket.accept()
try:
message = connectionSocket.recv(4096).decode()
filename = message.split()[1][1:]
with open(filename,"rb") as f:
output = f.read()
connectionSocket.sendall(output)
connectionSocket.close()
except IOError:
response = b"HTTP/1.1 404 Not Found rnrn"
connectionSocket.send(response)
connectionSocket.close()
When we only give the value 80 to the serverPort variable, the web server is running and can be accessed. However, when I give port 100, which I have checked is not used, as in the example, it does not work and cannot be accessed. What is the reason of this?