Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

VB.net P2P network tips


  • Please log in to reply
7 replies to this topic

#1 JosiahK

JosiahK

  • Members
  • 269 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:59 AM

Posted 14 February 2011 - 12:35 PM

My father has asked me to create a messenger program that will allow message sending between computers on a home network. In the example he gave he'd like to be able to run the program on his machine and send a little "come for dinner" message for those of us too deep in cyberspace and headphone-borne music to realize when people are actually talking.

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.
Quod non mortiferum, fortiorem me facit.
I don't read minds. Please help everyone by answering any questions and reporting on the results of any instructions. Query any concerns and explain problems or complications.

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:59 PM

Posted 14 February 2011 - 01:14 PM

Have you ever done anything with remote procedure calls?

#3 JosiahK

JosiahK
  • Topic Starter

  • Members
  • 269 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:59 AM

Posted 14 February 2011 - 02:46 PM

Not to date, but I'll try to work it out if you think that's the way to go.
It does seem to be a bit complex for the task at hand though, as though it would take more work just to set up the remoting (I understand that that is the VB equivalent) and connect between machines than it would take to just create the networking directly.
The other thing that I've come across in a preliminary look at RPC is the possibility of using threads. Do you think that these might allow running the network listener and GUI at the same time?
Quod non mortiferum, fortiorem me facit.
I don't read minds. Please help everyone by answering any questions and reporting on the results of any instructions. Query any concerns and explain problems or complications.

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:59 PM

Posted 14 February 2011 - 05:16 PM

How do are you proposing to 'create the network directly'? :)

Have you looked at maybe just utilizing an open source IM solution?

#5 JosiahK

JosiahK
  • Topic Starter

  • Members
  • 269 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:59 AM

Posted 14 February 2011 - 05:53 PM

Sorry, that was very badly worded. I mean that I need to identify which (dynamic) IPs in the local network range correspond to computers with my software running rather than guest computers, routers, printers, etc and which are therefore valid targets for connecting to. As far as I can tell I would still have to do that first in order to use RPC, and any solution that can do that would be 90% of the way toward sending basic data without RPC. I didn't think that there was a very significant body of FOSS software written in vb but I'll see what's out there.
I would rather do the programming for its own sake, just running freeware defeats the purpose somewhat (at least in my mind).
Thank you for your interest.
Quod non mortiferum, fortiorem me facit.
I don't read minds. Please help everyone by answering any questions and reporting on the results of any instructions. Query any concerns and explain problems or complications.

#6 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:59 PM

Posted 15 February 2011 - 09:10 AM

just running freeware defeats the purpose somewhat

Open Source does not mean Freeware.

What you can do with an open source solution is look at their code see what they did and how they did it, and use it as a basis for writing your own code. Since your experience is limited, you are going to have to look at something to show you what to do.

#7 JosiahK

JosiahK
  • Topic Starter

  • Members
  • 269 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:59 AM

Posted 15 February 2011 - 11:29 AM

Sounds like a good plan.
I'll see what I can find, and let you know how I get on.
Quod non mortiferum, fortiorem me facit.
I don't read minds. Please help everyone by answering any questions and reporting on the results of any instructions. Query any concerns and explain problems or complications.

#8 JosiahK

JosiahK
  • Topic Starter

  • Members
  • 269 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:59 AM

Posted 24 February 2011 - 02:24 PM

I had a look at the specific code for various tutorials on network-enabled applications and looked up the code and techniques in greater depth in the Microsoft documentation. Initially I tried setting up my own threading, but I've since found I can use the asynchronous beginreceive or beginaccept to wait for a connection while proceeding with the rest of the code. There are still some issues that I have to work through, but I'm sure they'll be resolved in time.
Quod non mortiferum, fortiorem me facit.
I don't read minds. Please help everyone by answering any questions and reporting on the results of any instructions. Query any concerns and explain problems or complications.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users