intranet chat application... need suggestions.

adshocker

Well-known member
Joined
Jun 30, 2007
Messages
180
Programming Experience
Beginner
hi all,

i'm planning on developing an intranet chat application using windows forms with vb.net on a Win2K platform. the appliation will be like that of the yahoo messenger where everyone can create a chat room, send a private message to others. it should have a list of users connected like the yahoo messenger.

i may need some suggestions on what to use in order to build these. i've been doing some reading. it seems that there are many ways i can do this.

1. Sockets
2. .Net Remoting
3. Peer to Peer/ Peer Channel

not sure if there's many more. can someone suggest what would be the best thing to use in my situation.

thanks.
 
hi,

thanks for the suggestion. i've been reading the article on the link you provided. is this also applicable to windows forms? from what i understood on the article is that it is a web application. sorry if i misunderstood.

thanks.
 
The link I provided uses the server as a windows service, you could do the same with a console program or windows form, however. If you google "vb.net remoting chat example" you will get plenty of other examples that you should probably glance over first.

Here is another resource that provides good explanation about remoting (using a chat application):
http://www.codeproject.com/KB/XML/remotingsimpleeng.aspx
 
It depends on whether you are going to have a server, or have it serverless. If it is serverless then you'll probably need to use sockets, at least to send out a UDP broadcast message to find out what other clients are available on the LAN.
 
for now i would go for something easy to develop. i have been reading quite a few articles, tutorials, walkthroughs using .Net Remoting.

i came to understand that in using .Net Remoting i need to have 3 components.

1. Server
2. Client
3. Remote Object ( Medium for the Server and Client ).

however, i'm still having a hard time understanding how to pass a dynamic message to the server and to other clients.

so far i was able to do the sample walkthrough from these sites.
http://msdn2.microsoft.com/en-us/lib...xt(VS.80).aspx
http://msdn2.microsoft.com/en-us/lib...27(VS.80).aspx
http://msdn2.microsoft.com/en-us/lib...f2(VS.80).aspx

can someone help me...

thanks.
 
You probably want both sides to have remote objects on the other, so that when someone sends a message from A to B, A calls a function on the remote object on B, passing in the message and any other details you need. The function runs at B's end, which means that you can update the user interface there to display the new message. Try getting it working one way to start with and then mirror it.
 
You probably want both sides to have remote objects on the other, so that when someone sends a message from A to B, A calls a function on the remote object on B, passing in the message and any other details you need. The function runs at B's end, which means that you can update the user interface there to display the new message.

does this mean that i can create a function that returns a string. then A can call that function and it will be executed at B. and it will return the string to B as well? or did i misunderstood something.
 
Either have a function that is on A that B calls to get a message or messages that returns a string or strings, or personally I would do it the other way around and B calls a function on A with a string parameter that contains the message. The code in the function will run on A and A can update its own user interface.

If you really want it Yahoo style, you can use the WebBrowser control to display messages - I'm fairly certain that is basically what they do.
 
thanks.

its not really necessary to have it like the yahoo messenger. just need to be able to private message users online and can create chat room as well.
 
OK, just that is a pretty easy way of doing it - you can just render HTML straight into it.
 
hey, i was able to send a text that i entered using B to A. that was pretty cool. thanks to wizzardmr42's suggestion. A is currently the one that listens (Host). B is the client.

so if i need to make a private messaging, i just need to have both A and B listen or i need to do something else?

the logic i'm thinking is that A (Host) will only have 1 instance but B (Client) will have multiple instances since this is the file/program that each user will be running (using the ClickOnce Deployment, will run thru IIS from the server pc).
 
Last edited:
It has been a while since I used remoting, but I think I'd probably use a Singleton object and have everything connecting to the one object. It is going to start getting complicated if you need to have lots of instances flying around, and each caller can pass a parameter to identify itself.

I think you need to decide whether you are having a server that will relay all the messages, or whether you are going to have a serverless architecture where all clients are the same program.

You can either have both A and B calling functions on each other, or you can have B1, B2, B3... connecting to A (server), and calling functions on A to find out who is connected and send messages. A can then raise events back on the appropriate B(s) so that they know that they have got a message. I've never actually done that, but I know it is possible. Another way of doing it if you want to avoid that is to get each B polling every so often to call a function on A to ask if it has messages.
 
well since this chat application will be integrated / combined with a database application, i'm gonna have a server where all clients connect to. but i'm gonna need to get an idea how for i.e B1 can send a message to B2 going thru A. more importantly, how will i get A to know that this message is for B2 from B1.

in any case, thanks a lot for all your help wizzardmr42. much appreciated.
 
In your server, use a hashtable to store all of the connected users. When a user wants to send a message, have them pass the name of the person. In the server, lookup this name in the hashtable and call that person's recievemessage function.

This is how I would do it, of course I don't know how you have coded it, though.
 
Back
Top