Search code examples
c#.netwinapisocketslan

How can I make two apps find and connect via LAN?


I need to scan the LAN for similar app running and then establish connection between them so I can exchange some commands between them. I code in C#. The only way I've found so far is to generate IP's and ping them... but it'd take too many time. Is there a quicker way? Maybe it can be done via WIN_API and then wrapped by C# [DllImport("..")] extern methods?


Solution

  • You could use UDP to broadcast your presence so that other applications could hear you and establish a socket with you for further communication.