A
A
albertalexandrov2019-10-21 16:36:11
Python
albertalexandrov, 2019-10-21 16:36:11

Acknowledging receipt of a packet by a TCP server in docker?

Hello!
There is a simple TCP server in Python running in Docker (an example from the documentation of the socketserver library ).

import socketserver

class MyTCPHandler(socketserver.BaseRequestHandler):

    def handle(self):
        self.data = self.request.recv(1024)
        print("{} wrote:".format(self.client_address[0]))
        self.request.sendall(подтвеждение)

if __name__ == "__main__":
    HOST, PORT = "localhost", 9999

    with socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server:
        server.serve_forever()

We have docker containers in rancher. The port is open to the outside. An open host and port are specified in the external device settings.
The external device sends data to us. For example:
b"\x01.\x80\x01\x82\x02\x15\x03867459044383263\x042\x00\x10\x00\x00 \xae|\xa5]0 \x8f\xdaR\x03\xdf\xc5=\x023\x00\ x00\x00\x00A'"

The TCP server is expected to acknowledge receipt of data by sending back the first and last two bytes. At the same time, in self.client_address[0] I see 10.42.0.0. That is, some internal ip.
I want to ask, in this case, will the confirmation packet reach the sender (external device)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alternativshik, 2019-10-21
@alternativshik

what prevents to take and check?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question