After some days of coding, I could write my simple Java chat server and client! It’s still amazing when you write a simple but strong network program. The way you feel the communication and see the bits on wire makes me always stand in awe. Anyway, you can find the program in here. Basically you should run the server program first, I’d suggest you go for the graphical version. It’s a multi thread program, allowing you to start/stop server whenever you want, while waiting for active connections and at the same time sending all data it gets from a connected client to the others.

Chat Server, after creating a server (It only shows you your ethernet IP address, to easily let the clients know!)
Then you should run the chat client. In which you can connect to any started server. You can also choose a nickname and a color and everybody else in the chat room sees ya with your preferred name & color! Also when you write a new message and hit enter, you can see the window title marquee effect which makes it easy to notice a window among many other open windows in your task bar! This marquee effect almost took me a day to complete, but I like its look & feel.
The last but not the least, thanks to Java, you can run both the server or client in Windows, Linux and Mac!

The chat client, before connection

Two chat clients connected to one server:port, talking!

The server monitoring all connected clients!

If you disconnect the server, all the connected clients will be disconnected too!
4 Responses to “Java Chat Server/Client”

RSS
hi bijan
good job man finally you start coding with damn JAVA
although I hate it because of pure performance but there is something more than cross platform ability for whom suggesting java to be used as main programming language in the near future anyway testing Biji chat on my work station remember me nice memento of coding with c.
thanks my friend and I think it’s good idea to include some more technical information on you posts.
Hey man, glad to see ya here.
Yeah, it’s my first semi-formal program in Java!
I hate the performance thing as well, specially that I spent almost a full day debugging a problem that looked like a thread synchronization error, but turned out to be a a stupid EditPane problem, a component that can show HTML text!
About the specifications, you’re right, I can include the source code here, but I’m planning to have my Farsi blog and leave the specs for there, somewhere that really might get useful for some college students or anyone interested.
hey
GOOD for you!congratulations…
I am not familiar with java programing,once one my friends set up a java program in my mobile set,by a mistake sent a strange massage to all my contacts!even those who were cleaned!
i was red in face,it forced me to reset my mobile set!every thing were cleaned and missed!bad luck
Hey. buddies!
sory this tiltle dosent refer to JAVA but
I would like to tell a very funny story about my pc problem and how I found the solution!
That was a couple of months (or about a year). When my desk top pc was going to stand bye over and over. Sometimes it was fine. Just YES or No, to the peaks and valleys I looked for a solution, no one had anything, either experts, computer hope’s forums and their online chat helps. Their helps and words made me feel crazy/fool then put me off! I checked all hardware’s and software’s problems referred to the issue (such a graphic card, heating up, replacing fans, viruses , unpack/packing H.D.D, replacing monitor/ mouse and bla bla bla…) indeed. They were useless.
Then By insist of my little brother I decided to buy a new desktop pc (to get rid of low speed and play the pc games fast!).The old one was for stone ages! Finlay I bought a new one (Viera Core2 Due: 5500T, 2 GB of RAM, Geforce T9800.360GB of space) .
Now it sounds like the issue will be fixed? Unfortunately I would say NO!! I freaked out. I was a loss what to do. And I started to do in person, seeking as a detective, drawing my gallantry sword to contest as a real knight in computer’s world, A Dispute between I and a bot. I was really sucked by the issue. Sought and sought. I promised myself to find it out
That was something rather odd about it. I found that when ever my charming brother plays the pc games by game controller; the pc wouldn’t go to stand by again. By the way, I had been replaced all plugs and external cables before. By chance while taking a look at the keyboard, it was dropped from my hands and the pc went to stand by. I deliberately hit it several times. The pc went to stand by repeatedly. I was amazed…replacing keyboard was an only task I did!
YES Buddies the key board caused that issue. Can’t you believe it, Can you? Yes that wasn’t the biggest one. I learnt a very main lesson from it: whenever there is a problem, don’t look for a tremendous reason!
NOW, there is a big major query in my mind: Why did the KEYBOARD cause the standing by issue?