A basic interface proved easy enough to create but I don't have much experience with networking. Obviously I don't want to mess around with a central server for something like this, but even the lower level socket controls in VB.net seem to be focussed on having a client-server model. I'm looking for advice on how to implement this.
I was thinking that I'd need to do the following:
- Send a message on a 255 broadcast IP asking for other computers running the program to respond and identify themselves. Alternatively simply identify the sending machine on the broadcast address. Computers should be Identified with their IP and a user friendly name.
- Listen for said broadcast message and respond as appropriate to build up a list of networked computers (which I'll put in a set of check boxes).
- Then once I have such a list and want to send a message, I'd need to connect to the specific IP of the recipient computer.
- Therefore I'd also need to be listening for that IP. Once the byte stream is transferred I can decode it and display the message quite easily.
I'm looking for some advice on how to implement this. I'm having particular trouble getting the same program to both listen for a connection and allow the user to initiate communication as I suppose is necessary for a P2P type program. What's happening is that the software hangs until it receives a response, and if I start it listening when it first opens the interface never even loads. If there are ways to build up a list of computers running the software that don't involve creating a second socket I'm also interested in hearing about them. And general observations on improvements will of course be very welcome.