Changeset 407 for PinConnection/UCommTCPServer.pas
- Timestamp:
- Aug 14, 2012, 10:31:30 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
PinConnection/UCommTCPServer.pas
r339 r407 7 7 uses 8 8 Classes, SysUtils, blcksock, synsock, UCommPin, UCommon, UThreading, 9 DateUtils, SpecializedList ;9 DateUtils, SpecializedList, tlntsend; 10 10 11 11 type … … 19 19 public 20 20 Parent: TCommTCPServer; 21 Stream: T MemoryStream;21 Stream: TListByte; 22 22 procedure Execute; override; 23 23 constructor Create(CreateSuspended: Boolean; … … 32 32 TCommTCPServerSession = class 33 33 private 34 procedure ReceiveData(Sender: TCommPin; Stream: T Stream);34 procedure ReceiveData(Sender: TCommPin; Stream: TListByte); 35 35 public 36 36 Server: TCommTCPServer; … … 67 67 { TCommTCPServerSession } 68 68 69 procedure TCommTCPServerSession.ReceiveData(Sender: TCommPin; Stream: TStream); 70 begin 71 Socket.SendStreamRaw(Stream); 69 procedure TCommTCPServerSession.ReceiveData(Sender: TCommPin; Stream: TListByte); 70 var 71 Mem: TMemoryStream; 72 begin 73 try 74 Mem := TMemoryStream.Create; 75 Stream.WriteToStream(Mem); 76 Socket.SendStreamRaw(Mem); 77 finally 78 Mem.Free; 79 end; 72 80 end; 73 81 … … 130 138 //if Socket.Socket = INVALID_SOCKET then Break; 131 139 132 Stream.Size := Length(Buffer); 133 Stream.Position := 0; 134 Stream.Write(Buffer[0], Length(Buffer)); 140 Stream.Count := Length(Buffer); 141 Stream.ReplaceBuffer(0, PByte(Buffer)^, Length(Buffer)); 135 142 Pin.Send(Stream); 136 143 DoSleep := False; … … 146 153 begin 147 154 inherited; 148 Stream := T MemoryStream.Create;155 Stream := TListByte.Create; 149 156 end; 150 157
Note:
See TracChangeset
for help on using the changeset viewer.