Is there a way to resend UDP packets using Twisted?

Problem: a simple UDP proxy - receiving UDP packets from several sources on port X and forwarding (forwarding) them to IP Y on port Z.

Description. I can create a simple UDP server using twisted ones and easily receive incoming packets. However, I cannot find a way to resend these packets (their data) further using Twisted. Is there any specific, kosher and twist-like way to do this in a twisted order, or should I use the simple pockon sock.sendto method in a method that processes the received data in Twisted?

+3
source share
1 answer

- :

class MyProtocol(DatagramProtocol):
    def datagramReceived(self, datagram, addr):
        # use self.transport.write to send stuff
        some_where = ('192.168.0.1',5001)
        self.transport.write( datagram, some_where )
+2

Source: https://habr.com/ru/post/1772908/


All Articles