Thread: online game
View Single Post
Old Apr 18th, 2008, 2:20 PM   #10
Freaky Chris
Hobbyist Programmer
 
Freaky Chris's Avatar
 
Join Date: Dec 2007
Location: England
Posts: 169
Rep Power: 1 Freaky Chris is on a distinguished road
Send a message via MSN to Freaky Chris
Re: online game

hmm, im not sure about this as i am only just beginning Java so im not sure how it would handle something like what im about to suggest.

When a new client connects to the server a connection is established and sotred. Then it is passed to a new Thread and all data from that client is handled by that thread.

Now if you store that connection in a global array, if this is possible in Java. Then it becomes avaliable to everything. This means that other threads that are running for other clients can access the connection via the global array and send data to it.

Cheers,
Chris
__________________
Who said i couldn't program
sarcasm = raw_input('Type in a sarcastic remark: ')
print sarcasm
Freaky Chris is offline   Reply With Quote