Search code examples
socketsnetwork-programmingpascallazarus

Send and receive on the same socket at the same time


I'm using Lnet komponent but I dod't know is it important.

Can I send and receive on the same socket at the same time via multiple threads?


Solution

  • Yes, but you'll obviously want to protect the sending logic with appropriate synchronization so that you can make sure that a complete message (according to your protocol) is sent from one thread before another thread starts writing a different message.