Simon, your code wont properly work because it assume to receive one single and 
complete command at each OnDataAvailable event. That is complete wrong. See 
Michael's reply.

-- 
francois.pie...@overbyte.be
Embarcadero MVP
http://www.overbyte.be
http://francois-piette.blogspot.com





-----Message d'origine-----
De : TWSocket [mailto:twsocket-boun...@lists.elists.org] De la part de Simon 
Lewis
Envoyé : samedi 6 décembre 2014 12:19
À : TWSocket Archives
Objet : Re: [twsocket] Sending font styles and colors over network

Thanks for the Information am using TCP with  custom process here code

procedure TLobbyServer.SocketServerDataAvailable(Sender: TObject; ErrCode: 
Word);
begin
   if ErrCode <> 0 then Exit;
  with Sender as TWSocketClient do
  begin
    RunCommand(ReceiveStr, Sender as TWSocketClient);
  end;
end;

procedure TLobbyServer.RunCommand(comdata: string; rSocket: TWSocketClient); var
  command: string;
begin
  { INCOMING ENCODED DATA STRING }
  comdata := DecodeStr(comdata);
  { DECODE INCOMING DATA STRING }
  while DecodeCommand(comdata, command, dat) do begin
    case StrToIntDef(command, -1) of
      00: begin
           LobbyChatMsgs(dat[0], dat[1], dat[2], dat[3], StrToInt(dat[4]), 
StrToInt(dat[5]), TFontStyles(Byte(StrToInt(dat[6]))), rSocket);
         end;
    end;
end;

procedure TLobbyServer.LobbyChatMsgs(const LobbyID: String; const UserName: 
String; const Msg: String; const FontName: String; FontColor: TColor;
FontSize: Integer; const FontStyle: TFontStyles; rSocket: TWSocketClient); begin
  if Trim(UserName) = '' then
  begin
    Exit;
   end else begin
    SendLobbyCommand(LobbyID, 'š04œ'
        + LobbyID + 'œ'
        + UserName + 'œ'
        + Msg + 'œ'
        + FontName + 'œ'
        + IntToStr(FontColor) + 'œ'
        + IntToStr(FontSize) + 'œ'
        + FontStyletoStr(FontStyle) + 'œ');
    end;
end;

any way to improve it?, I know it be hard reading code with no having all the 
correct codes so on also would you be able to supple me with a simple image 
stream demo for video I been looking all over for one and Never found it I 
would like to add video to my app one day ha.

-----Original Message-----
From: Simon Lewis
Sent: Friday, December 05, 2014 6:53 PM
To: TWSocket Archives
Subject: Sending font styles and colors over network

I know am flooding this news group with pointless questions but I really need 
to know, am building a chat system and I want to send basic text chat with font 
size/font color/font styles for each user am doing this via strings and sending 
to server and back to client but I noticed after a while and when more then a 
few users are typing the text chat becomes unstable and incorrect font styles / 
colors and sizes happen and only way to fix it is to re-login so am wondering 
what would be best way to send the information over network so it would be 
stable and reliable.

Thanks 

--
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

-- 
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