Advertisement

Why must chat mesg go through server?

Started by October 31, 2003 12:06 AM
19 comments, last by HaywireGuy 21 years, 3 months ago
So just assume I don''t know how IRC server works (infact I really don''t know), I came up with this idea: Say there are three clients (C1, C2 and C3) connected to the server in a chat room. And now the fourth client C4, logs on to the same chat room. Then the server forwards the IP addresses of C1, C2 and C3 to him (C4). Now the rest of conversation is done peer-to-peer. (Of course C1, C2, C3 have to know the new C4''s IP too) This way, the server can stay out of the intensive messagin'' when there are many users in a chat room. Forgive my ignorance if all the servers are already doin'' it this way. Just in case they''re not, why? Isn''t this a feasible way? Or it''s best not to reveal users'' IPs?
Well, the main problem is that peer-2-peer isn''t allways possible. For instance users behind nats might not be able to communicate with each other.
I''m doing a p2p game myself and altough I send input directly from player to player I also route everything through the server in case someone has a "bad" connection.
Another alternative would be to assign a local server, with a public ip, in each channel to unload the main server.
Advertisement
Cool, I'm new to networkin'. I did a search on "NAT" and
found "Network Address Translator", I suppose this is what you
meant. So what does it do? I'm not sure how does it stops P2P
from workin', because to the outside world, one's IP address is
used by others to communicate with him. If P2P fails, does that
mean things like connectin' to the server will fail too?

Sorry if that sounds stupid, I'm a beginner to networkin'
Thanks!

P/S: By the way, that "assign local server" idea is cool!






[edited by - HaywireGuy on October 31, 2003 2:52:01 AM]
AFAIK, NAT is used by a router in network. If you have a set of computers each with an internal ip address (typically 192.168.x.x) they all tie in with the router that connects with the modem that continues to the outside. What NAT does is take a request from one of the computers on the internal network and pass it on as if it originates from the broadcast ip of the modem and then is able to forward data back to the internal ip. Its sort of a way of "fooling" the modem as if a request is made from only one computer while NAT addressing is able to tie in a request with the right internal ip.
Well, R2D22U2..
Hmmm... still that shouldn''t stop the P2P from workin''... Say a
message originates from Peer1, the internal IP address "I1"
will be translated by NAT and goes out as public address "P1".

So to Peer2, it sees the message comes from address "P1", and
when it replies message, it sends it to "P1", right? Then the
NAT translated the public address "P1" into internal
address "I1", thus gettin'' to Peer1. If this does not work, I
don''t see how a web browser will work in this scenario...

Gosh I must have missed out somethin'' important here!
Somebody cares to enlighten me a lit''? Thanks...
quote:
Original post by HaywireGuy
Hmmm... still that shouldn''t stop the P2P from workin''... Say a
message originates from Peer1, the internal IP address "I1"
will be translated by NAT and goes out as public address "P1".

So to Peer2, it sees the message comes from address "P1", and
when it replies message, it sends it to "P1", right? Then the
NAT translated the public address "P1" into internal
address "I1", thus gettin'' to Peer1. If this does not work, I
don''t see how a web browser will work in this scenario...

Gosh I must have missed out somethin'' important here!
Somebody cares to enlighten me a lit''? Thanks...



You do end up with problems when using NATs, although my guess is it has more to do with the built in firewalls most home NATs seem to have..

I am behind a NAT with built in firewall and I have problems connecting with certain internet protocols to anyone using the same type of router as me. I also have problems with some other things for connecting to any home PC.

As for your original p2p chat topic.. IIRC p2p chat is already being done with Jabber, so it definatly can work
Shoot Pixels Not People
Advertisement
My senior project in college was a peer 2 peer instant messaging service. It was developed to work over an ad hoc wireless network which means there were no servers so everyone had to connect to everyone else. It was certainly an interesting project but after working on it I see why the server set up is used. It makes things a lot easier when you have a central system make all of the decisions on who gets what messages.

Clippy:"OMG, A NUMBAR! Let me format it for you"
Unsuspecting Student: "Ahhhhh! Damn you paperclip you ruined my paper. A thousand deaths upon you!"

"Game Programming: Without programming you''ve just got game"
"Pfft, Facts! Facts can be used to prove anything!" -- Homer J. Simpson
Other than being a "central system to make decisions", the
server can be the place all chat sessions start.

I understand the set up, I just wish to reduce server loads
because the server does not have to know about the chat
messages. It just takes care of the log in/out and other server
specific tasks.

So I was thinkin'' to let all the clients in a chat session
handle this chat message forwardin'' task. It seems that this
P2P approach will not have any problems with NAT, I think it
can be a good way to go.
another point:
with a server, the client has to send his msg only once -> to the server.

in a peer to peer network, a client has to send a msg to all other clients, using a lot of bandith on the client.

Lazzar
---------------------------------------------------------if god gave us the source code, we could change the world!
NAT''s block incoming connections because the addressing on the inside and the outside of the NAT is completely different. The only way for a machine outside of the NAT to get an address for a machine on the inside is for the inside machine to talk to it first. Even then the address of the inside machine will be different every time from the outside machine''s point of view.

Some ISP''s also block incoming connections to force you to pay for thier "business" services. Every ISP agreement I''ve seen for home users forbids you to host servers. Most don''t care for piddly stuff like this but some do actively block you.

This is the major problem with peer-to-peer. Many people on the Internet essentially only have one-way connections. They can connect out but nobody can connect in.
-Mike

This topic is closed to new replies.

Advertisement