Click to See Complete Forum and Search --> : Run a Server App Constantly on HTTP?


Demonpants Software
December 7th, 2005, 08:24 PM
Hey guys,

I'm making a simple server->multi client program to make a room for people to find other users available for my online games. I want to gt a prototype applet version up first, where there is a server application running on my website (at all times), that clients will connect to and recieve/forward chat/stat information to. The server basically manages all connections and sends each one char information and available players. The clients have the GUI and let the user enter/save information to be sent to the server.

At this point, I simply want to create a Java application to represent the server, rather than going into SQL or anything like that. How can I have a Java application constantly running on a server that I can't see? (I access it thropugh ftp) Also, would there be a way to perhaps have clients share server load, like how AIM makes chat rooms? If one person is in the room they count as the server, and once they leave another person takes their place, etc.

Data sent is realtively small and there shouldn't be too many users, so bandwidth and the works shouldn't be an issue. What's the best way to do this?

cjard
December 9th, 2005, 11:09 AM
this is kind of confusing.. why not just install an IRC server and use the JPilot applet?

rooms are not made, they are virtual constructs defined in the protocol. I'd have an object representing a client, and when the client joins a room, add them to a list, held in a hashtable. the list is holds a list of clients in a particular room. the hashtable provides named access to the room

a client announces it is sending a message to a room:
<message room="general" text="hi everyone"/>

the server does (pseudocode):
List roomPeople = roomsHashTable.get("general");
for each client in roomPeople{
client.sendMessage("<message room="general" text="hi everyone">);
}



the client also has a list of rooms that the user is participating in but these are like, separate windows or something...


as people join and leave a room the server also announces to all other recipients.. have a play with IRC and youll start to understand what i mean - you can imagine the protocol by watching the way it works
or, you can read the IRC RFC documents