I'm developing a custom instant messenger for the office as we have need of rather unique IM needs.

So far I have two groups of users: Group and Individual.

The group users can comunicate with their group and all other types of groups. Individual users can only communicate with one specified user.

So right now the flow goes:

Client notifies server it's online.
Server sends a filtered list of other same group members
Server sends a list of of other different group members
If user has individual members attatached, it sends a list of those users too
Server then iterates through all other connnect clients to send the online presence of this new client to the appropriate users.

I'm doing this on server side to cut back on bandwidth (probably not nessacary, but requested)

My question would be this: Should I keep the server more simple and just serve as an echo server and echo everything? Then the contact list filtering would be done on the client side. I just can't figure out which is a better use of system resources. More filtering and less socketwork or more socketwork and less filtering on the server?

Recommended Answers

All 4 Replies

It all depends on what you want to do. If the server's processor (server in context of the computer hosting the server software) is dedicated to running your server app, then I don't see the harm in having the server do it. However, if you are using the server machine for other tasks..... let's say, this box is a web-server, an ftp server, AND your IM server.... it would be best to cut the server out of the loop as much as possible.... The other issue is the bandwidth.... if they requested that the bandwidth be kept down, most of the processing should be done on the server.

Another good way to go about this, is to have the server keep track of everyone's IP that's been connected, and when a new client comes on, the new client recieves a list of all the users and their IP's (and other information such as group and what not). Then the client program connects to all the relevant parties (contacts, and groups) [it has their IP, it's no problem to connect to them], and send them all a "Hi I'm here" message. When they log off, or on form unload, it sends them all a "bye guys" message. When it sends an IM to someone on the list, that person's IM Client Becomes a Server.

Basically, it would be like building a Peer To Peer (P2P) Messenger Service. So, The client connects to the server, gets a list of users/ip's/groups/permissions/whatever, the client parses that data, connects to everyone relevant, sends a hello there, disconnects from everyone, but becomes a server. Then someone double clicks the new client's name in the list, the messenger makes a connection attempt to the new client's IP, the new client's IP accepts the connection request, and they establish a convo.....This minimizes the use of the server (and the bandwidth of the server) drastically.....

It's a good layout, but hard to code, and I have no clue how much you already have built, and/or if you want to start over with a new concept...... but if they requested it minimize bandwith, the above solution is probably the best one..... the best solutions always require the most work.

I've got a dedicated machine to run this, P4 dual core, 3.2GHz, 512 MB RAM (which i'll ask to get bumped up to 1GB) so I'll probably just keep most of the processesing on the server. With over 500 computers running the client, it will be easier to update the server, but not the clients. . . . well, IT could run a script but, still, Thanks for dissertation, it has helped.

Sure, I just ask you let me know what you plan to do (so others reading can get a good resolution to it too). If you have any other questions, ask away... someone will answer.

Sure, I just ask you let me know what you plan to do (so others reading can get a good resolution to it too). If you have any other questions, ask away... someone will answer.

After chatting with our sys admin, we have decided to go with the server doing the bulk of the filtering. In an enviroment where corporate headquarters is really picky about what goes on locally, haveing the server do the filtering and being in charge of tight security only seams right. Also, our network is very busy with mission critical applications which need the bulk of the bandwidth, so cutting down on bandwidth is nice. The P2P sulotion won't fly due to "security" concerns.

When it's all said and done, I'll post back to let you know how it works. . .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.