The moose likes Servlets and the fly likes Using a Servlet for a chat program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Using a Servlet for a chat program" Watch "Using a Servlet for a chat program" New topic

Using a Servlet for a chat program

Kay Crocker

Joined: Nov 01, 2001
Posts: 17
Wondering if this is possible? Basically allowing two users on different machines to communicate (TCP) but routing through a servlet located on a different server and not on either of the two machines.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
Sure - why not? Plenty of examples using HTTP and browsers, with the servlet keeping track of chat "rooms" and users. There is a simple one in my Servlets and JSP book.
author of:
Mark Leong
Ranch Hand

Joined: Dec 11, 2000
Posts: 60
You certainly can. You can view an example at the following site:

If you are using Netscape or other browers, might have some problems. I do not have time to debug yet. Seems to be OK with IE which I have used to develop in (mistake).
I agree. Here's the link:
subject: Using a Servlet for a chat program
It's not a secret anymore!