tags:

views:

91

answers:

4
+1  Q: 

Peer-to-peer chat

Hello,im wondering if it's possible to create p2p chat application without server(so there is no need in external static ip.Is it true?)?

+2  A: 

It is possible. But you must have someway for one computer to tell the other computer what their IP number is. You could email it to your friend or call them on the phone or post it on a message board.

EddieC
So for example - your friend must listen to this ip and you must send pockets on his ip?
Yes, that is the general idea. You send packets to his ip. From that, he will know your IP and can send things back. Djondal is correct, you probably have to deal with the port forwarding thing. It is a lot to have to deal with just because you don't have a static IP and do not want to use a dedicated server somewhere.
EddieC
he could aswell use a website only for exchanging ips upon successfull login or so ... which you could do with any simple hosting plan in my opnion...
Prix
Yep. The server is used only for matchmaking i.e to handle NAT traversal. Once the client IPs are traversable then each client disconnects from the matchmaking server and can do standard P2P
zebrabox
+2  A: 

EddieC is right if the computers are located inside the same sub-network (LAN) or if the computers'ip is their interface to the Internet (WAN public ip). In that case, you can just use the ip's and ports directly.

However, usually, knowing the computers ip is not enough because the machines are located behind routers inside sub-networks. Thus, because the computers are hidden behind the routers, you will have to configure the routers to foward the packets to the right computers as function of the ports used.

Have a look at : http://wiki.vuze.com/w/Port_forwarding

If you do not want to use ip's because they are dynamic, you can configure urls with Dynamic DNS services.

Good luck

djondal
+1  A: 

If this program only has to work on a local network (LAN), there is something called broadcasting which might be of interest to you. It allows a packet to be sent out to every device on the network without having to know their IPs (then other instances of your program could reply with the IP of their machines so you could set up proper connections).

This won't work over the internet, though (imagine being able to broadcast to every computer connected to the internet!).

Cameron
A: 

Thanks for your help, but i'm wondering if it will be able to work without Dynamic DNS(as far as i know some games don't require to have public IP to be a host(Call of Duty: Modern Warfare 2), am i right?)?