Link to home
Start Free TrialLog in
Avatar of CipherIS
CipherISFlag for United States of America

asked on

C# Auto Discovery

I found this article that contains code on a client / server application can communicate with each other without knowing their IP address prior the the first network handshake.  The article discusses using UDP.

http://www.nullskull.com/a/1551/clientserver-autodiscovery-in-c-and-udp-sockets.aspx

My understanding of UDP is that it is not as secure as TCP.  

Is there a TCP example?
Or any other advice?  I need a client to auto discover a server app without knowing the IP.  I know bonjour is a possibility but looking for another solution.

Thanks
Avatar of it_saige
it_saige
Flag of United States of America image

For this situation you want to use UDP.  It doesn't have to be secure because you are not making a secure connection, instead you are sending a network wide signal.  It's basically a ping.  For this ping you want the smaller footprint that a UDP packet allows for.  Anyone that is listening for the ping responds.

After you receive the ping acknowledgement do you attempt to make the secure tcp connection.  I believe that you think that you have to use a different port than that of which you currently use but that is not the case.

TCP/80 is not the same as UDP/80 (not implying that this is the port you use).

WCF even implements helper classes for UdpDiscovery:  https://msdn.microsoft.com/en-us/library/dd456791(v=vs.110).aspx

-saige-
Avatar of CipherIS

ASKER

Saige,

So if I understand correct, use UDP for the ping.  Once I receive the acknowledgement, then switch to TCP to make the secure connection?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of it_saige
it_saige
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I wouldn't have to worry about the security issues with UDP (e.g. DOS)?