Re: peer to peer messaging
- From: Thomas Weidenfeller <nobody@xxxxxxxxxxxxxxxx>
- Date: Wed, 25 May 2005 16:22:13 +0200
Bond wrote:
Hi! I want to write an application that will send a message to another
computer using Sockets. I've wrote a simple echo client server before
using Sockets but this application is different. I want to be able to
send a message to any other computer running this application. *** The
problem that I'm running into is that when setting up the socket, if
the computer is hooked up in a network,
It would be a problem if the computer is *not* "hooked up" in a network. No network connection, no way to connect to it (ignoring the local loop for the moment). Was that sentence really meant as you wrote it?
I know the IP address of the router...
Which router? Anyhow, routers are irrelevant when addressing a remote computer - the routers and the routing "just" has to be configured correctly in advance. You do not address a router directly when you want to connect to some computer behind that router. You still use an IP address for the computer, not for the router. If you have a name instead of an IP address, also fine. This will just require an additional DNS request to translate the name to the IP address of the computer - of course assuming that DNS for the computer has been set up correctly.
somehow I have to be able to send it directly to the computer...
If there is no direct route, you simply can't. But that is not a problem. The job of a router is to route your packets to the intended destination by choosing an appropriate next hop. Why do you want to circumvent these helpful devices?
BTW: The first routing usually already happens inside your own computer. Your computer's routing table is consulted to decide which next hop should be used, and which physical interface.
how can I do this? When a user uses the application, they log in and if there is any information I can store on the server that would help me do this, I can... any help would be great. Thanks!
Which server? A central one? Didn't you say you want to implement a P2P application. What information? Storage?
I am usually flamed for the following advice, but I am used to it, so here it comes:
Please get a pen and paper and make up your mind what you really want. Sort your thought, sort out your terminology and read a textbook. You seem to be confused about how this whole IP networking thing works. A good introduction could help here. It is not only a good idea to know the basics when starting to design a networking application, but it is invaluable knowledge when you have to start to troubleshoot your application.
Comer, Douglas E.: Internetworking with TCP/IP Vol 1.
or the late W. R. Stevens'
Stevens, W. R.: TCP/IP Illustrated, Vol.1 : The Protocols
come to mind. Any good library should have it, too.
/Thomas -- The comp.lang.java.gui FAQ: ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq .
- Follow-Ups:
- Re: peer to peer messaging
- From: Bond
- Re: peer to peer messaging
- References:
- peer to peer messaging
- From: Bond
- peer to peer messaging
- Prev by Date: Re: Creating a unique random id
- Next by Date: Re: Matrix Wanted
- Previous by thread: Re: peer to peer messaging
- Next by thread: Re: peer to peer messaging
- Index(es):
Relevant Pages
|