Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 18th, 2007, 10:14 PM   #1
programmingnoob
Hobbyist Programmer
 
Join Date: Feb 2006
Posts: 154
Rep Power: 3 programmingnoob is on a distinguished road
server - messenger chat...

I am coding a centralized server messenger...

I wonder what approach do Yahoo, AIM etc use for text chat?

Suppose two clients start chatting with each other, now during the chat conversation, does every single message during the conversation go through the server and the server redirects it to the proper client? OR does the server redirects the first message and then the two clients start communicating directly ie their messages get transmitted to each other directly, not going through the server?

did I make my question clear?
programmingnoob is offline   Reply With Quote
Old Jul 18th, 2007, 10:55 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
I would suggest that you research the UDP protocol, the client/server paradigm, and the methods for getting around that. It isn't pretty, if you care about security.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jul 18th, 2007, 11:06 PM   #3
programmingnoob
Hobbyist Programmer
 
Join Date: Feb 2006
Posts: 154
Rep Power: 3 programmingnoob is on a distinguished road
Quote:
Originally Posted by DaWei View Post
I would suggest that you research the UDP protocol, the client/server paradigm, and the methods for getting around that. It isn't pretty, if you care about security.
I am using TCP, not UDP...

just wanted to know about AIM, Yahoo etc...

do you know whether they let the clients communicate directly after a point or does every single message go through the server at any point of the conversation?
programmingnoob is offline   Reply With Quote
Old Jul 18th, 2007, 11:28 PM   #4
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 763
Rep Power: 3 Jimbo is on a distinguished road
I'm pretty sure MSN and AIM have a separate feature for directly connecting to the other person. Otherwise, I'm pretty sure it goes through the server; for instance, with AIM you can be logged on in several locations (MSN has something similar in the works I think), and they'll all receive the messages. I've not tried being logged in several times and using a direct connection. And no idea how Yahoo or Jabber or other protocols behave, as I don't use them.
__________________
<insert disclaimer here>
<insert shameless plug for Visual Studio here>
Jimbo is offline   Reply With Quote
Old Jul 18th, 2007, 11:48 PM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Any time one 'client' can receive from another 'client', and respond, your system has been compromised. That's at the user's discretion, of course. The user has allowed software to be downloaded that compromises security. If the downloaded compromise has not (yet) been hacked, you will be extremely lucky. Most users in this position that have not been stolen blind have escaped solely because they have been judged as having no information on their system that is worthwhile, relatively speaking.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jul 19th, 2007, 12:04 AM   #6
glimmy
Programmer
 
glimmy's Avatar
 
Join Date: May 2005
Location: Minnesota
Posts: 42
Rep Power: 0 glimmy is on a distinguished road
Send a message via AIM to glimmy
Concerning Jabber, it uses servers for communication, but there is no single main server like AIM or MSN. (see RFC 3920 Section 2 briefly describes clients, servers, etc. within Jabber)

Otherwise, unless you are doing this for educational reasons, it would be more secure and probably easier to implement if you used an existing protocol like XMPP (Jabber) or perhaps build off of IRC.
glimmy is offline   Reply With Quote
Old Jul 19th, 2007, 6:36 AM   #7
Duck
Programmer
 
Join Date: Jun 2006
Location: England London
Posts: 72
Rep Power: 3 Duck is on a distinguished road
Quote:
Originally Posted by programmingnoob View Post
I am coding a centralized server messenger...

I wonder what approach do Yahoo, AIM etc use for text chat?

Suppose two clients start chatting with each other, now during the chat conversation, does every single message during the conversation go through the server and the server redirects it to the proper client? OR does the server redirects the first message and then the two clients start communicating directly ie their messages get transmitted to each other directly, not going through the server?

did I make my question clear?
The easiest approach is for every message to go through the server, Client->Server->Client.

Otherwise as you say, if client_1 wanted to communicate with client_2, client_1 could retrieve, from the server, the IP address of client_2, and then connect directly to client_2. This would be a 'peer to peer' connection.

As a n00b programmer you should not attempt to write a p2p application. It is not easy to create a p2p connection, there are a lot of problems involved. For example most most PCs connect to the internet from behind a router, when a connection is made through the router a NAT (network address translator) is implemented to convert private network addresses in an internal network (LAN) into one public address for the internet. But the NAT only works one way, a PC on a LAN can initiate a connection through the NAT (router) to a 'server' on the internet. But a 'server' on the internet cannot initiate a connection through a NAT to a PC on a LAN, because the NAT (router) would not know which PC on the LAN to direct the connection to.

There is a way round this problem, they call it 'hole punching technology' where each peer creates and listens for a connection at the same time on the same port. Blah Blah blah, read up on p2p and NAT.

I think MSN messenger does try and establish a p2p connection, but if it fails all traffic goes through a server (EDIT: but the other way around - a reliable C->S->C connection is 1st established then p2p is attempted). p2p connections can't always be established.
__________________
.

Last edited by Duck; Jul 19th, 2007 at 6:49 AM.
Duck is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with C# TCP/IP Server csrocker101 C# 3 Mar 15th, 2007 12:32 AM
FTP Server in Python Sane Python 1 Mar 31st, 2006 10:25 PM
Instant Messenger using RMI Necronaut Java 0 May 30th, 2005 1:39 PM
Instant Messaging App Help AusTex C 0 Apr 27th, 2005 4:52 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:07 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC