Reputation: 147
I'm developing a server which involves a lot of broadcasting of identical data to multiple clients over TCP.
Something like:
for(i = 0; i < n; i++)
{
send(client[i], buffer, ...);
}
Is there any facility to enable me to combine this into a single user/kernel transaction? An analog to vectored I/O is what I'm after (except ofcourse multiple socket handles; not buffers)
Notes:
Upvotes: 2
Views: 413
Reputation: 135
When you are using Windows 8 or Windows Server 2012 you can make use of the Registered I/O extensions to get rid of the syscall overhead and to reduce latency.
Upvotes: 4
Reputation: 311039
I'm developing a server which involves a lot of broadcasting of identical data to multiple clients over TCP. You send to one client at a time, over a distinct connection.
There is no such thing as broadcast over TCP. It is a unicast, point-to-point protocol.
Is there any facility to enable me to combine this into a single user/kernel transaction? An analog to vectored I/O is what I'm after (except ofcourse multiple socket handles; not buffers)
No, there is no 'analog to vectored I/O' that encompasses 'multiple socket handles'. And if there was it would only solve your problem as far as the NIC. The repeated packets on the network would still constitite a latency and bandwidth issue.
The protocol choice (TCP) is non-negotiable (not my decision)
So, as per our discussion, that rules out UDP broadcast and UDP multicast.
LSPs and the like are not an option.
Whatever that means. Labelled Switched Path? Layered Service Provider? Label Distribution Protocol?
Potential solutions must be compatible with overlapped I/O
As there aren't any potential solutions, the issue does not arise.
The reason this is a problem is due to performance requirements (soft real-time; very sensitive to latency and jitter).
Bad luck. You would be better off using UDP multicast as it would also economize on network bandwidth, but I see that's not an option.
Upvotes: 0
Reputation: 598001
TCP does not have any broadcast capabilities. You must copy your outgoing data to each connected client individually. If you don't want to do that, then you need to switch to UDP or Multicast instead, both of which support single-send broadcasting.
Upvotes: 2