Solved

C# Auto Discovery

Posted on 2016-07-26
4
112 Views
Last Modified: 2016-07-26
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
0
Comment
Question by:CipherIS
  • 2
  • 2
4 Comments
 
LVL 33

Expert Comment

by:it_saige
ID: 41729734
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-
0
 
LVL 1

Author Comment

by:CipherIS
ID: 41729930
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
0
 
LVL 33

Accepted Solution

by:
it_saige earned 500 total points
ID: 41729943
Exactly.  The information that you send back, is supposed to carry an acknowledgement, ip address and a port (if required).  The client then takes the acknowledgement and connects to the ip address and port using whatever mechanism you employ to secure tcp communications.

-saige-
0
 
LVL 1

Author Comment

by:CipherIS
ID: 41730200
I wouldn't have to worry about the security issues with UDP (e.g. DOS)?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question