'getting the data of TCP segment and convert it to UDP datagram using scapy

I am developing an app, in which i am stuck at a point where i need to get the data in a TCP segment and convert/ encapsulate into a UDP datagram for transmission into a channel. is there anyway of doing it.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source