Hello Simon,

I  don't know if you do lengthy operations but if yes you should use a
worker thread to let the main socket thread always available.

regards.

SL> Am currently using ICS for a large chat system but now my service
SL> is getting bigger am starting to worry I not really done the
SL> socket code best I can below is the server side for receiving
SL> string commands also other idea am interested in looking into is a
SL> main server that controls other servers so can host multiple
SL> servers around world and main server will link them all and client will 
know were to connect.

SL> procedure TComServer.SocketServerDataAvailable(Sender: TObject; ErrCode: 
Word);
SL> begin
SL>   with Sender as TWSocketClient do
SL>   begin
SL>      RunCommand(ReceiveStr, Sender as TWSocketClient);
SL>   end;
SL> end;

SL> then the run common would split the string command in there own
SL> sections and read from array and assign correct string to dat[id]

SL> procedure TComServer.RunCommand(comdata: string; rSocket: TWSocketClient);
SL> var
SL>   command: string;
SL>   dat: array [0..50] of string;
SL> begin
SL>   { INCOMING ENCODED DATA STRING }
SL>   comdata := DecodeStr(comdata);

SL>   { DECODE INCOMING DATA STRING }
SL>   while DecodeCommand(comdata, command, dat) do begin
SL>   case StrToIntDef(command, -1) of
SL>      00: LoginToService(dat[0], rSocket);
SL>    end;
SL> end;

SL> now am starting to think maybe string is not a good way to go
SL> about this on a large scale service so am wondering if anyone else
SL> has ever built a chat system and what methods did you use?, any
SL> information be great. Thanks a lot

SL> Yours
SL> Simon


                      mailto:do...@yahoo.com

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to