Hi
I think you have to check if the whole message has been received before
decoding it
if you send large strings they might get truncated in blocks while sending.
Use a length of string in the message while sending and check in the
receiving client if the length has been received.
send string part:
[Length in bytes] message (=string to send)
receive string part
check if length in bytes has been received
if message receive then Decode message
Regards,
Jasja
Op 26-2-2016 om 17:01 schreef Simon Lewis:
Am working on a multi draw feature and I noticed when sending the data that is
stored in a stringlist via socket it don't always draw the full image like its
missing data am sending the full string list via socket and drawing it in real
time but for some reason it don't send the full content so am wondering is
there limit on the sendtext or a better way to send large data ?
client send code;
procedure TrDrawGate.SendDrawStrings(const ARoomID, AUserID: string; Mode,
PenLx, Penly, PenX, PenY, PenColor, PenWidth: integer);
begin
if ARoomID = IMData.m_CurrentRoomID then
begin
EnterCriticalSection(CritSect);
try
WSocket.SendStr(BuildMessage(02, [ARoomID, AUserID,
IntToStr(Integer(Mode)), IntToStr(PenLx), IntToStr(Penly), IntToStr(PenX),
IntToStr(PenY), IntToStr(PenColor), IntToStr(PenWidth), '#13#10']));
finally
LeaveCriticalSection(CritSect);
end;
end;
end;
server code’;
procedure TDrawServer.GetDrawHistory(const RoomID: String;
rSocket: TWSocketClient);
var
i: Integer;
begin
EnterCriticalSection(CritSect);
try
for i := 0 to (SocketServer.ClientCount - 1) do
begin
if (SocketServer.Client[i].Room = RoomID) then
begin
SocketSendCodedBuffer(rSocket,
SocketServer.Client[i].hpList.Get(RoomID));
end;
end;
finally
LeaveCriticalSection(CritSect);
end;
end;
procedure TDrawServer.SocketSendCodedBuffer(ASocket: TWSocketClient; const
AString: string);
var
Buf : AnsiString;
begin
if (ASocket <> nil) then
if (ASocket.State = WsConnected) then try
Buf := AnsiString(EncodeString(AString));
ASocket.Send(@Buf[1], Length(Buf));
except on E: Exception do
Display('SocketSendCodedBuffer ' + E.ClassName + ': ' + E.Message);
end;
end;
any information or examples be grateful thanks.
--
Met vriendelijke groeten - Best regards - Mit freundlichen Grüßen -
Bestu kveðjur - Sincères salutations
machandel
tel :
fax :
mob :
*Jasja Glasbeek*
/Sales / Export / Logistics / ICT/
(+31) 516 42 50 20
(+31) 516 42 19 42
(+31) 620 16 58 48
addr :
skype :
email :
web :
Turfsteker 19, 8433 HT, Haulerwijk
the netherlands (NL)
jasja.glasbeek <skype:jasja.glasbeek>
ja...@machandel.com <mailto:ja...@machandel.com>
www.machandel.com <http://www.machandel.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