Changeset 407 for PinConnection/UCommTCPClient.pas
- Timestamp:
- Aug 14, 2012, 10:31:30 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
PinConnection/UCommTCPClient.pas
r339 r407 7 7 uses 8 8 Classes, SysUtils, blcksock, synsock, UCommPin, UCommon, UThreading, 9 DateUtils ;9 DateUtils, SpecializedList; 10 10 11 11 type … … 19 19 public 20 20 Parent: TCommTCPClient; 21 Stream: T MemoryStream;21 Stream: TListByte; 22 22 procedure Execute; override; 23 23 constructor Create(CreateSuspended: Boolean; … … 33 33 FOnReceiveData: TReceiveDataEvent; 34 34 FReceiveThread: TCommSocketReceiveThread; 35 procedure ReceiveData(Sender: TCommPin; Stream: T Stream);35 procedure ReceiveData(Sender: TCommPin; Stream: TListByte); 36 36 procedure SetActive(const AValue: Boolean); 37 37 public … … 53 53 { TCommTCPClient } 54 54 55 procedure TCommTCPClient.ReceiveData(Sender: TCommPin; Stream:TStream); 55 procedure TCommTCPClient.ReceiveData(Sender: TCommPin; Stream: TListByte); 56 var 57 Mem: TMemoryStream; 56 58 begin 57 59 if FActive then begin 58 Socket.SendStreamRaw(Stream); 60 try 61 Mem := TMemoryStream.Create; 62 Stream.WriteToStream(Mem); 63 Socket.SendStreamRaw(Mem); 64 finally 65 Mem.Free; 66 end; 59 67 end; 60 68 end; … … 120 128 RecvBuffer(Buffer, Length(Buffer)); 121 129 122 Stream.Size := Length(Buffer); 123 Stream.Position := 0; 124 Stream.Write(Buffer[0], Length(Buffer)); 130 Stream.Count := Length(Buffer); 131 Stream.ReplaceBuffer(0, Pointer(Buffer)^, Length(Buffer)); 125 132 Pin.Send(Stream); 126 133 end else InBufferUsed := 0; … … 134 141 begin 135 142 inherited; 136 Stream := T MemoryStream.Create;143 Stream := TListByte.Create; 137 144 end; 138 145
Note:
See TracChangeset
for help on using the changeset viewer.