Regis d’Aubarede wrote in post #1181855:
writing data to socket mean a transfer between your process memory
to TCP buffer ( usually 64 KB ). So if buffers are free, you can send
in a loop.
TCP was build in idea of file transfer, it is not the good media
for realtime stream.
for more efficient in timing precision, you can use:
- UDP datagramme
- UDP Multicast : you send one datagram, and then
switchs/router will duplicate it
- raw socket
Thanks for the answer but I think you misunderstand my question. I have
an array of six sockets open in six threads and I can send the data to
each but the problem is they’re sent asynchronously.
The data is actually an XML request and I’ve already sent all but the
last “>” character and when a condition becomes true, I send that
character to each of the six sockets I have open and primed.
So it’s essentially doing the following loop …
Send “>” via socket 1
Send “>” via socket 2
Send “>” via socket 3
Send “>” via socket 4
Send “>” via socket 5
Send “>” via socket 6
That works but the time taken to send the data via socket 1 in 200ms
whilst by the time the data has been sent via socket 6 the time elapsed
is nearly 1 second.
I need the data to all six sockets in 200ms i.e. synchronously rather