| | |
creating an instant messenger program in java
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2005
Posts: 2
Reputation:
Solved Threads: 0
hey,
I am trying to develop an instant messenger on lines of yahoo ....
jus started out buh have hit a few roadblocks ... and I am new to java too and this is and application I am developing to learn java.
Some problems I am facing are:
1. I have mulitple functions like userLogin and registerNewUser etc in my client ... and I use an objectwriter stream ... so how can i tell on the server as to wht operation is to be performed.
2. I have to maintain a list of contacts for a perticular user ... each user has a unique Id. so what can be the most efficient way to do this ... storing all info for each user will take lots of space ...
3. In C# there is a mechanism to create a UUID ... this is also availabe in java 5.0 buh i could not find any such mechnism in java 1.40...
thanks!!
Mark
I am trying to develop an instant messenger on lines of yahoo ....
jus started out buh have hit a few roadblocks ... and I am new to java too and this is and application I am developing to learn java.
Some problems I am facing are:
1. I have mulitple functions like userLogin and registerNewUser etc in my client ... and I use an objectwriter stream ... so how can i tell on the server as to wht operation is to be performed.
2. I have to maintain a list of contacts for a perticular user ... each user has a unique Id. so what can be the most efficient way to do this ... storing all info for each user will take lots of space ...
3. In C# there is a mechanism to create a UUID ... this is also availabe in java 5.0 buh i could not find any such mechnism in java 1.40...
thanks!!
Mark
ok, what i've done on my little chat thingy is quite "basic". i have my server running and then a client would log in and the server would take the username and see if anyone is connected with that name yet(stores them in a vector - too busy at work to start making it more complex with a database and passwords and stuff, but that will come).
what you need to do, is if a user logs in, then send out a list of all the logged in users to the clients(i keep them in a vector in my server app and then run a method that sends out data to each of them). your clients should then take that list (something like "<users>bob-_-steve-_-billy-_-john-_-") and break it up with StringTokenizer(there they're separated with "-_-", but you can use anthing you like that you think would be unique) and just add that to the JList in your app or whatever you use to display the users(use a vector to store those usernames in and then just use userList.setListData( userVector ) to update the list).
if someone disconnects, then you send out a list again and your clients would then see if anything new is added or if anything isn't there and then update the list.
does that make it any clearer?
i've got my program, but haven't got a use for it yet. anyone want to buy it?
what you need to do, is if a user logs in, then send out a list of all the logged in users to the clients(i keep them in a vector in my server app and then run a method that sends out data to each of them). your clients should then take that list (something like "<users>bob-_-steve-_-billy-_-john-_-") and break it up with StringTokenizer(there they're separated with "-_-", but you can use anthing you like that you think would be unique) and just add that to the JList in your app or whatever you use to display the users(use a vector to store those usernames in and then just use userList.setListData( userVector ) to update the list).
if someone disconnects, then you send out a list again and your clients would then see if anything new is added or if anything isn't there and then update the list.
does that make it any clearer?
i've got my program, but haven't got a use for it yet. anyone want to buy it?
•
•
Join Date: Jun 2005
Posts: 3
Reputation:
Solved Threads: 0
Hi everyone,
I am developing a peer-to-peer file transfer system. And I also had to maintain user names and their information in the server for later use. You can save the user info by creating a thread which sends user info to the server. And the server must have a thread running to receive the information...This is for sending info to server...
And you can use multicasting to send a message to all clients simultaneously...I implemented the mechanism, but the problem is multicasting allows only 224.0.0.1 to 239.255.255.255-- these IP addresses to use...I used 228.6.7.8. But lots of exceptions were generated and said that this IP address can't be used? Cannot I use localhost to implement multicasting? What do you guys think?
Best of luck
Razib
I am developing a peer-to-peer file transfer system. And I also had to maintain user names and their information in the server for later use. You can save the user info by creating a thread which sends user info to the server. And the server must have a thread running to receive the information...This is for sending info to server...
And you can use multicasting to send a message to all clients simultaneously...I implemented the mechanism, but the problem is multicasting allows only 224.0.0.1 to 239.255.255.255-- these IP addresses to use...I used 228.6.7.8. But lots of exceptions were generated and said that this IP address can't be used? Cannot I use localhost to implement multicasting? What do you guys think?
Best of luck
Razib
•
•
•
•
Hey This was very interesting to read, I had been wondering for a long time on how to make a IM of my own but this really does not help much could someone show me where to go to learn about this style of coding plz it would help me out alot thanx's
Nick
You may find it in school library if you look for it, is one of common titles
and NO there is not electronic version, if there is then it is illegal
and NO there is not electronic version, if there is then it is illegal
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Mar 2004
Posts: 802
Reputation:
Solved Threads: 40
Sorry piyali, I only understand English grammar. Since nobody is aware of Google, I decided to be a nice guy and find some resources for all of you.
http://java.sun.com/developer/online...a2/socket.html
http://java.sun.com/docs/books/tutor...ets/index.html
http://www.cise.ufl.edu/~amyles/tcpchat/
http://www.javaworld.com/javaworld/j...2-sockets.html
Once you know how to use the socket classes and understand the functionality of an instant messenger program, then you'll be able to write a simple chat client without too much difficulty. If you wish to create a client over an existing chat network, that's a whole other issue.
http://java.sun.com/developer/online...a2/socket.html
http://java.sun.com/docs/books/tutor...ets/index.html
http://www.cise.ufl.edu/~amyles/tcpchat/
http://www.javaworld.com/javaworld/j...2-sockets.html
Once you know how to use the socket classes and understand the functionality of an instant messenger program, then you'll be able to write a simple chat client without too much difficulty. If you wish to create a client over an existing chat network, that's a whole other issue.
![]() |
Other Threads in the Java Forum
- Previous Thread: Needs Brainstorming!!!
- Next Thread: school task help
Views: 33640 | Replies: 33
| Thread Tools | Search this Thread |
Tag cloud for Java
3d @param affinetransform android api apple applet application arc arguments array arrays automation binary bluetooth byte c# chat class classes click client code color compare component corrupted database detection draw eclipse error event exception file fractal game givemetehcodez graphics gui guitesting helpwithhomework html ide image input integer j2me java java.xls javaprojects jmf jni jpanel julia keytool keyword linux list loop map method methods mobile netbeans newbie number object oracle pong print problem producer program programming project projectideas read recursion reflection rim scanner screen server set size sms socket sort sql string swing terminal test threads time transfer tree web windows





