You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I send a HTTP request from my laptop to http://127.0.0.1:8080/ -> All works, I get the response and my local code answering
When I send a HTTP request from another POD -> My local program gets the request, but the client is hang - like the TCP Socket is waiting for an answer, and just hangs
Rebuilt URL to: http://echoserver-od1:8080/
Trying 172.20.46.129...
Connected to echoserver-od1 (172.20.46.129) port 8080 (#0)
GET / HTTP/1.1
Host: echoserver-od1:8080
User-Agent: curl/7.47.0
Accept: /
>
HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: BaseHTTP/0.6 Python/3.9.6
< Date: Sun, 25 Feb 2024 12:39:55 GMT
< Content-type: text/plain
<
Recv failure: Connection reset by peer
Closing connection 0
curl: (56) Recv failure: Connection reset by peer
#!/usr/bin/python3# Create a python echo-server that listens on port 8080 and echoes back any input it receives from a client.# The server should be able to handle multiple clients concurrently.importhttp.serverimportsocketserverclassEchoHandler(http.server.BaseHTTPRequestHandler):
defdo_GET(self):
self.send_response(200)
self.send_headers()
self.send_body()
defdo_POST(self):
content_length=int(self.headers.get('Content-Length', 0))
data=self.rfile.read(content_length)
self.send_response(200)
self.send_headers()
self.send_body(data)
defsend_headers(self):
self.send_header('Content-type', 'text/plain')
self.end_headers()
defsend_body(self, data=None):
ifdata:
self.wfile.write(data)
else:
self.wfile.write(self.path.encode())
deflog_message(self, format, *args):
# Log the request to the consoleprint(f"[{self.log_date_time_string()} | {self.client_address[0]}] {self.requestline}")
defrun_server():
PORT=8080withsocketserver.TCPServer(("", PORT), EchoHandler) ashttpd:
print(f"Server running on port {PORT}")
httpd.serve_forever()
if__name__=="__main__":
run_server()
python macOS
mirrord.json
The text was updated successfully, but these errors were encountered: