I need a single C# program that runs as both a client and server simultaneously. I would like to send a UDP broadcast containing the contents of a WinForms TextBox whenever a button is pressed, and display the contents of the message that was broadcast in a MessageBox on all the clients who receive the broadcast. Basically, I'm envisioning the following:
-Simple UI with TextBox and "send" Button that launches the Listener thread (mentioned below) when it comes up
-Function that sends a datagram with the contents of the textbox via UDP broadcast
-Listener thread that listens for UDP packets on a specific port (let's go with 40040) that throws up a MessageBox with the contents of the message every time one is received
Thanks in advance for your help!