My program creates two threads: one thread sends data, another thread receives data.
Is it possible to:
- Create a socket in the main thread and use it in anther thread?
- Use the same socket in both the sending and the receiving thread?
The reason I want to use the same socket for both sending and receiving is that I want the sending and receiving socket to use the same source port.
I did find out the RSocketServ can be used in multiple threads (using the ShareAuto() method), but what use is sharing the RSocketServ when you can't share the sockets themselves?