Solved

C# Auto Discovery

Posted on 2016-07-26
4
72 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 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