I am looking to send a short message to all IP's on a subnet in C#. I am using a TCPClient and the problem is that the TCPClient.Connect() function takes a good 20 seconds to throw it's Exception if there is nothing using that IP. I would hoping for something on the order of a couple of milliseconds if possible.
All I am really looking to do is send a couple bytes to each address and receive an ACK from certain ones. If there is a way to do this without explicitly using the Connect(), the TCPClient, or even just setting a Connection timeout that I don't know about, I could easily switch to that instead.
I'm looking to run this program on multiple computers and this broadcast is going to be used so that each instance will know the IP's of the other instances. So really all I need is to send a couple bytes for identification.