difegui difegui - 11 months ago 84
C Question

Sockets UDP TCP C

I have a question:
Is it possible to execute

to send information from one process which is initialized on UDP to another process initialized on TCP (this is all in the same

I have one process which receives information on UDP and this one has to send this information locally to the TCP one and I don't know how to connect (I know you cannot connect with UDP, I mean just send the datagram) them.
Can anyone help me?

Thank you.

Answer Source

The process that is receiving UDP packets has to open a separate TCP socket to send to the other process.

So at startup this process should first open up a UDP socket to receive datagrams. Then it gets a TCP socket and uses that to connect to the other process using the connect function. Then, whenever data comes in on the UDP socket, you take that data and send it out using send over the TCP socket for the other server to read.