You've already forked lazarus-ccr
Use TByteDynArray instead of string for raw buffer
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@771 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -30,13 +30,14 @@ Type
|
|||||||
TInt64S = Int64; TInt64U = QWord;
|
TInt64S = Int64; TInt64U = QWord;
|
||||||
TBoolData = Boolean;
|
TBoolData = Boolean;
|
||||||
TEnumData = Int64;
|
TEnumData = Int64;
|
||||||
TAnsiStringData = AnsiString;
|
TAnsiStringData = TBinaryString;
|
||||||
TWideStringData = WideString;
|
TWideStringData = WideString;
|
||||||
{$IFDEF WST_UNICODESTRING}
|
{$IFDEF WST_UNICODESTRING}
|
||||||
TUnicodeStringData = UnicodeString;
|
TUnicodeStringData = UnicodeString;
|
||||||
{$ENDIF WST_UNICODESTRING}
|
{$ENDIF WST_UNICODESTRING}
|
||||||
TAnsiCharacter = AnsiChar;
|
TAnsiCharacter = AnsiChar;
|
||||||
TWideCharacter = WideChar;
|
TWideCharacter = WideChar;
|
||||||
|
TByteDynArray = wst_types.TByteDynArray;
|
||||||
|
|
||||||
TFloat_Single_4 = Single;
|
TFloat_Single_4 = Single;
|
||||||
TFloat_Double_8 = Double;
|
TFloat_Double_8 = Double;
|
||||||
@ -66,6 +67,7 @@ Type
|
|||||||
{$IFDEF WST_UNICODESTRING}
|
{$IFDEF WST_UNICODESTRING}
|
||||||
procedure WriteUnicodeStr(Const AData : TUnicodeStringData);
|
procedure WriteUnicodeStr(Const AData : TUnicodeStringData);
|
||||||
{$ENDIF WST_UNICODESTRING}
|
{$ENDIF WST_UNICODESTRING}
|
||||||
|
procedure WriteBinary(const AData : TByteDynArray);
|
||||||
|
|
||||||
procedure WriteSingle(Const AData : TFloat_Single_4);
|
procedure WriteSingle(Const AData : TFloat_Single_4);
|
||||||
procedure WriteDouble(Const AData : TFloat_Double_8);
|
procedure WriteDouble(Const AData : TFloat_Double_8);
|
||||||
@ -97,6 +99,7 @@ Type
|
|||||||
{$IFDEF WST_UNICODESTRING}
|
{$IFDEF WST_UNICODESTRING}
|
||||||
function ReadUnicodeStr():TUnicodeStringData;
|
function ReadUnicodeStr():TUnicodeStringData;
|
||||||
{$ENDIF WST_UNICODESTRING}
|
{$ENDIF WST_UNICODESTRING}
|
||||||
|
function ReadBinary() : TByteDynArray;
|
||||||
|
|
||||||
function ReadSingle():TFloat_Single_4;
|
function ReadSingle():TFloat_Single_4;
|
||||||
function ReadDouble():TFloat_Double_8;
|
function ReadDouble():TFloat_Double_8;
|
||||||
@ -231,6 +234,7 @@ Type
|
|||||||
{$IFDEF WST_UNICODESTRING}
|
{$IFDEF WST_UNICODESTRING}
|
||||||
procedure WriteUnicodeStr(Const AData : TUnicodeStringData);
|
procedure WriteUnicodeStr(Const AData : TUnicodeStringData);
|
||||||
{$ENDIF WST_UNICODESTRING}
|
{$ENDIF WST_UNICODESTRING}
|
||||||
|
procedure WriteBinary(const AData : TByteDynArray);
|
||||||
|
|
||||||
procedure WriteSingle(Const AData : TFloat_Single_4);
|
procedure WriteSingle(Const AData : TFloat_Single_4);
|
||||||
procedure WriteDouble(Const AData : TFloat_Double_8);
|
procedure WriteDouble(Const AData : TFloat_Double_8);
|
||||||
@ -268,6 +272,7 @@ Type
|
|||||||
{$IFDEF WST_UNICODESTRING}
|
{$IFDEF WST_UNICODESTRING}
|
||||||
function ReadUnicodeStr():TUnicodeStringData;
|
function ReadUnicodeStr():TUnicodeStringData;
|
||||||
{$ENDIF WST_UNICODESTRING}
|
{$ENDIF WST_UNICODESTRING}
|
||||||
|
function ReadBinary() : TByteDynArray;
|
||||||
|
|
||||||
function ReadSingle():TFloat_Single_4;
|
function ReadSingle():TFloat_Single_4;
|
||||||
function ReadDouble():TFloat_Double_8;
|
function ReadDouble():TFloat_Double_8;
|
||||||
@ -437,6 +442,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDataStore.WriteBinary(const AData : TByteDynArray);
|
||||||
|
var
|
||||||
|
i : TInt32S;
|
||||||
|
begin
|
||||||
|
i := Length(AData);
|
||||||
|
WriteInt32S(i);
|
||||||
|
if ( i > 0 ) then
|
||||||
|
FStream.Write(AData[1],i);
|
||||||
|
end;
|
||||||
|
|
||||||
{$IFDEF WST_UNICODESTRING}
|
{$IFDEF WST_UNICODESTRING}
|
||||||
procedure TDataStore.WriteUnicodeStr(const AData: TUnicodeStringData);
|
procedure TDataStore.WriteUnicodeStr(const AData: TUnicodeStringData);
|
||||||
|
|
||||||
@ -615,6 +630,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TDataStoreReader.ReadBinary() : TByteDynArray;
|
||||||
|
var
|
||||||
|
i : TInt32S;
|
||||||
|
begin
|
||||||
|
i := ReadInt32S();
|
||||||
|
SetLength(Result,i);
|
||||||
|
if ( i > 0 ) then
|
||||||
|
FStream.ReadBuffer(Result[1],i);
|
||||||
|
end;
|
||||||
|
|
||||||
{$IFDEF WST_UNICODESTRING}
|
{$IFDEF WST_UNICODESTRING}
|
||||||
function TDataStoreReader.ReadUnicodeStr(): TUnicodeStringData;
|
function TDataStoreReader.ReadUnicodeStr(): TUnicodeStringData;
|
||||||
var
|
var
|
||||||
|
@ -113,7 +113,7 @@ procedure TTCPTransport.SendAndReceive(ARequest, AResponse: TStream);
|
|||||||
var
|
var
|
||||||
wrtr : IDataStore;
|
wrtr : IDataStore;
|
||||||
buffStream : TMemoryStream;
|
buffStream : TMemoryStream;
|
||||||
strBuff : TBinaryString;
|
binBuff : TByteDynArray;
|
||||||
bufferLen : LongInt;
|
bufferLen : LongInt;
|
||||||
begin
|
begin
|
||||||
buffStream := TMemoryStream.Create();
|
buffStream := TMemoryStream.Create();
|
||||||
@ -123,10 +123,10 @@ begin
|
|||||||
wrtr.WriteAnsiStr(Target);
|
wrtr.WriteAnsiStr(Target);
|
||||||
wrtr.WriteAnsiStr(ContentType);
|
wrtr.WriteAnsiStr(ContentType);
|
||||||
wrtr.WriteAnsiStr(Self.Format);
|
wrtr.WriteAnsiStr(Self.Format);
|
||||||
SetLength(strBuff,ARequest.Size);
|
SetLength(binBuff,ARequest.Size);
|
||||||
ARequest.Position := 0;
|
ARequest.Position := 0;
|
||||||
ARequest.Read(strBuff[1],Length(strBuff));
|
ARequest.Read(binBuff[1],Length(binBuff));
|
||||||
wrtr.WriteAnsiStr(strBuff);
|
wrtr.WriteBinary(binBuff);
|
||||||
buffStream.Position := 0;
|
buffStream.Position := 0;
|
||||||
wrtr.WriteInt32S(buffStream.Size-4);
|
wrtr.WriteInt32S(buffStream.Size-4);
|
||||||
buffStream.Position := 0;
|
buffStream.Position := 0;
|
||||||
|
@ -139,7 +139,8 @@ var
|
|||||||
locInStream, locOutStream : TMemoryStream;
|
locInStream, locOutStream : TMemoryStream;
|
||||||
wrtr : IDataStore;
|
wrtr : IDataStore;
|
||||||
rdr : IDataStoreReader;
|
rdr : IDataStoreReader;
|
||||||
buff, trgt,ctntyp, frmt : TBinaryString;
|
trgt,ctntyp, frmt : TBinaryString;
|
||||||
|
buff : TByteDynArray;
|
||||||
rqst : IRequestBuffer;
|
rqst : IRequestBuffer;
|
||||||
i : PtrUInt;
|
i : PtrUInt;
|
||||||
begin
|
begin
|
||||||
@ -160,7 +161,7 @@ begin
|
|||||||
trgt := rdr.ReadAnsiStr();
|
trgt := rdr.ReadAnsiStr();
|
||||||
ctntyp := rdr.ReadAnsiStr();
|
ctntyp := rdr.ReadAnsiStr();
|
||||||
frmt := rdr.ReadAnsiStr();
|
frmt := rdr.ReadAnsiStr();
|
||||||
buff := rdr.ReadAnsiStr();
|
buff := rdr.ReadBinary();
|
||||||
|
|
||||||
{$IFDEF WST_DBG}
|
{$IFDEF WST_DBG}
|
||||||
WriteLn(buff);
|
WriteLn(buff);
|
||||||
@ -169,6 +170,7 @@ begin
|
|||||||
rdr := nil;
|
rdr := nil;
|
||||||
locInStream.Size := 0;
|
locInStream.Size := 0;
|
||||||
locInStream.Write(buff[1],Length(buff));
|
locInStream.Write(buff[1],Length(buff));
|
||||||
|
SetLength(buff,0);
|
||||||
locInStream.Position := 0;
|
locInStream.Position := 0;
|
||||||
rqst := TRequestBuffer.Create(trgt,ctntyp,locInStream,locOutStream,frmt);
|
rqst := TRequestBuffer.Create(trgt,ctntyp,locInStream,locOutStream,frmt);
|
||||||
rqst.GetPropertyManager().SetProperty(sREMOTE_IP,AContext.Binding.PeerIP);
|
rqst.GetPropertyManager().SetProperty(sREMOTE_IP,AContext.Binding.PeerIP);
|
||||||
@ -180,7 +182,7 @@ begin
|
|||||||
locOutStream.Read(buff[1],i);
|
locOutStream.Read(buff[1],i);
|
||||||
locOutStream.Size := 0;
|
locOutStream.Size := 0;
|
||||||
wrtr := CreateBinaryWriter(locOutStream);
|
wrtr := CreateBinaryWriter(locOutStream);
|
||||||
wrtr.WriteAnsiStr(buff);
|
wrtr.WriteBinary(buff);
|
||||||
locOutStream.Position := 0;
|
locOutStream.Position := 0;
|
||||||
{$IFDEF INDY_10}
|
{$IFDEF INDY_10}
|
||||||
AContext.Connection.IOHandler.Write(locOutStream,locOutStream.Size,False);
|
AContext.Connection.IOHandler.Write(locOutStream,locOutStream.Size,False);
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
<TargetFileExt Value=".exe"/>
|
<TargetFileExt Value=".exe"/>
|
||||||
<Icon Value="0"/>
|
<Icon Value="0"/>
|
||||||
<UseXPManifest Value="True"/>
|
<UseXPManifest Value="True"/>
|
||||||
<ActiveEditorIndexAtStart Value="0"/>
|
|
||||||
</General>
|
</General>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<ProjectVersion Value=""/>
|
<ProjectVersion Value=""/>
|
||||||
@ -38,16 +37,14 @@
|
|||||||
<PackageName Value="wst_core"/>
|
<PackageName Value="wst_core"/>
|
||||||
</Item2>
|
</Item2>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="10">
|
<Units Count="14">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="ws_client.pas"/>
|
<Filename Value="ws_client.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ws_client"/>
|
<UnitName Value="ws_client"/>
|
||||||
<CursorPos X="13" Y="8"/>
|
<CursorPos X="3" Y="26"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="16"/>
|
||||||
<EditorIndex Value="0"/>
|
<UsageCount Value="30"/>
|
||||||
<UsageCount Value="29"/>
|
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="echo_service_proxy.pas"/>
|
<Filename Value="echo_service_proxy.pas"/>
|
||||||
@ -55,9 +52,7 @@
|
|||||||
<UnitName Value="echo_service_proxy"/>
|
<UnitName Value="echo_service_proxy"/>
|
||||||
<CursorPos X="3" Y="35"/>
|
<CursorPos X="3" Y="35"/>
|
||||||
<TopLine Value="31"/>
|
<TopLine Value="31"/>
|
||||||
<EditorIndex Value="4"/>
|
<UsageCount Value="30"/>
|
||||||
<UsageCount Value="29"/>
|
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit1>
|
</Unit1>
|
||||||
<Unit2>
|
<Unit2>
|
||||||
<Filename Value="echo_service.pas"/>
|
<Filename Value="echo_service.pas"/>
|
||||||
@ -65,36 +60,28 @@
|
|||||||
<UnitName Value="echo_service"/>
|
<UnitName Value="echo_service"/>
|
||||||
<CursorPos X="3" Y="25"/>
|
<CursorPos X="3" Y="25"/>
|
||||||
<TopLine Value="14"/>
|
<TopLine Value="14"/>
|
||||||
<EditorIndex Value="6"/>
|
<UsageCount Value="30"/>
|
||||||
<UsageCount Value="29"/>
|
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit2>
|
</Unit2>
|
||||||
<Unit3>
|
<Unit3>
|
||||||
<Filename Value="..\..\..\synapse_tcp_protocol.pas"/>
|
<Filename Value="..\..\..\synapse_tcp_protocol.pas"/>
|
||||||
<UnitName Value="synapse_tcp_protocol"/>
|
<UnitName Value="synapse_tcp_protocol"/>
|
||||||
<CursorPos X="1" Y="74"/>
|
<CursorPos X="41" Y="151"/>
|
||||||
<TopLine Value="69"/>
|
<TopLine Value="148"/>
|
||||||
<EditorIndex Value="3"/>
|
|
||||||
<UsageCount Value="15"/>
|
<UsageCount Value="15"/>
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit3>
|
</Unit3>
|
||||||
<Unit4>
|
<Unit4>
|
||||||
<Filename Value="..\..\..\soap_formatter.pas"/>
|
<Filename Value="..\..\..\soap_formatter.pas"/>
|
||||||
<UnitName Value="soap_formatter"/>
|
<UnitName Value="soap_formatter"/>
|
||||||
<CursorPos X="1" Y="235"/>
|
<CursorPos X="1" Y="235"/>
|
||||||
<TopLine Value="224"/>
|
<TopLine Value="224"/>
|
||||||
<EditorIndex Value="2"/>
|
|
||||||
<UsageCount Value="15"/>
|
<UsageCount Value="15"/>
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit4>
|
</Unit4>
|
||||||
<Unit5>
|
<Unit5>
|
||||||
<Filename Value="..\..\..\service_intf.pas"/>
|
<Filename Value="..\..\..\service_intf.pas"/>
|
||||||
<UnitName Value="service_intf"/>
|
<UnitName Value="service_intf"/>
|
||||||
<CursorPos X="1" Y="221"/>
|
<CursorPos X="1" Y="221"/>
|
||||||
<TopLine Value="210"/>
|
<TopLine Value="210"/>
|
||||||
<EditorIndex Value="5"/>
|
|
||||||
<UsageCount Value="14"/>
|
<UsageCount Value="14"/>
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit5>
|
</Unit5>
|
||||||
<Unit6>
|
<Unit6>
|
||||||
<Filename Value="E:\lazarus26r2.2.2.2\fpc\2.2.2\source\rtl\objpas\sysutils\sysutilh.inc"/>
|
<Filename Value="E:\lazarus26r2.2.2.2\fpc\2.2.2\source\rtl\objpas\sysutils\sysutilh.inc"/>
|
||||||
@ -113,9 +100,7 @@
|
|||||||
<Filename Value="E:\lazarus26r2.2.2.2\fpc\2.2.2\source\rtl\inc\wstringh.inc"/>
|
<Filename Value="E:\lazarus26r2.2.2.2\fpc\2.2.2\source\rtl\inc\wstringh.inc"/>
|
||||||
<CursorPos X="20" Y="87"/>
|
<CursorPos X="20" Y="87"/>
|
||||||
<TopLine Value="74"/>
|
<TopLine Value="74"/>
|
||||||
<EditorIndex Value="1"/>
|
|
||||||
<UsageCount Value="14"/>
|
<UsageCount Value="14"/>
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit8>
|
</Unit8>
|
||||||
<Unit9>
|
<Unit9>
|
||||||
<Filename Value="E:\lazarus26r2.2.2.2\fpc\2.2.2\source\rtl\inc\systemh.inc"/>
|
<Filename Value="E:\lazarus26r2.2.2.2\fpc\2.2.2\source\rtl\inc\systemh.inc"/>
|
||||||
@ -123,129 +108,36 @@
|
|||||||
<TopLine Value="223"/>
|
<TopLine Value="223"/>
|
||||||
<UsageCount Value="9"/>
|
<UsageCount Value="9"/>
|
||||||
</Unit9>
|
</Unit9>
|
||||||
|
<Unit10>
|
||||||
|
<Filename Value="..\..\..\wst_types.pas"/>
|
||||||
|
<UnitName Value="wst_types"/>
|
||||||
|
<CursorPos X="16" Y="30"/>
|
||||||
|
<TopLine Value="16"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit10>
|
||||||
|
<Unit11>
|
||||||
|
<Filename Value="..\..\..\indy_tcp_protocol.pas"/>
|
||||||
|
<UnitName Value="indy_tcp_protocol"/>
|
||||||
|
<CursorPos X="69" Y="148"/>
|
||||||
|
<TopLine Value="137"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit11>
|
||||||
|
<Unit12>
|
||||||
|
<Filename Value="..\..\..\synapse_http_protocol.pas"/>
|
||||||
|
<UnitName Value="synapse_http_protocol"/>
|
||||||
|
<CursorPos X="15" Y="56"/>
|
||||||
|
<TopLine Value="45"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit12>
|
||||||
|
<Unit13>
|
||||||
|
<Filename Value="..\..\..\indy_http_protocol.pas"/>
|
||||||
|
<UnitName Value="indy_http_protocol"/>
|
||||||
|
<CursorPos X="3" Y="147"/>
|
||||||
|
<TopLine Value="143"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit13>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="30" HistoryIndex="29">
|
<JumpHistory Count="0" HistoryIndex="-1"/>
|
||||||
<Position1>
|
|
||||||
<Filename Value="..\..\..\service_intf.pas"/>
|
|
||||||
<Caret Line="220" Column="1" TopLine="209"/>
|
|
||||||
</Position1>
|
|
||||||
<Position2>
|
|
||||||
<Filename Value="..\..\..\service_intf.pas"/>
|
|
||||||
<Caret Line="436" Column="1" TopLine="425"/>
|
|
||||||
</Position2>
|
|
||||||
<Position3>
|
|
||||||
<Filename Value="..\..\..\service_intf.pas"/>
|
|
||||||
<Caret Line="437" Column="1" TopLine="426"/>
|
|
||||||
</Position3>
|
|
||||||
<Position4>
|
|
||||||
<Filename Value="..\..\..\service_intf.pas"/>
|
|
||||||
<Caret Line="438" Column="1" TopLine="427"/>
|
|
||||||
</Position4>
|
|
||||||
<Position5>
|
|
||||||
<Filename Value="..\..\..\service_intf.pas"/>
|
|
||||||
<Caret Line="221" Column="1" TopLine="210"/>
|
|
||||||
</Position5>
|
|
||||||
<Position6>
|
|
||||||
<Filename Value="..\..\..\soap_formatter.pas"/>
|
|
||||||
<Caret Line="225" Column="13" TopLine="206"/>
|
|
||||||
</Position6>
|
|
||||||
<Position7>
|
|
||||||
<Filename Value="..\..\..\soap_formatter.pas"/>
|
|
||||||
<Caret Line="220" Column="1" TopLine="209"/>
|
|
||||||
</Position7>
|
|
||||||
<Position8>
|
|
||||||
<Filename Value="..\..\..\synapse_tcp_protocol.pas"/>
|
|
||||||
<Caret Line="106" Column="1" TopLine="95"/>
|
|
||||||
</Position8>
|
|
||||||
<Position9>
|
|
||||||
<Filename Value="..\..\..\synapse_tcp_protocol.pas"/>
|
|
||||||
<Caret Line="107" Column="1" TopLine="96"/>
|
|
||||||
</Position9>
|
|
||||||
<Position10>
|
|
||||||
<Filename Value="..\..\..\synapse_tcp_protocol.pas"/>
|
|
||||||
<Caret Line="108" Column="1" TopLine="97"/>
|
|
||||||
</Position10>
|
|
||||||
<Position11>
|
|
||||||
<Filename Value="..\..\..\soap_formatter.pas"/>
|
|
||||||
<Caret Line="235" Column="1" TopLine="224"/>
|
|
||||||
</Position11>
|
|
||||||
<Position12>
|
|
||||||
<Filename Value="..\..\..\synapse_tcp_protocol.pas"/>
|
|
||||||
<Caret Line="134" Column="1" TopLine="123"/>
|
|
||||||
</Position12>
|
|
||||||
<Position13>
|
|
||||||
<Filename Value="..\..\..\synapse_tcp_protocol.pas"/>
|
|
||||||
<Caret Line="74" Column="1" TopLine="63"/>
|
|
||||||
</Position13>
|
|
||||||
<Position14>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="18" Column="72" TopLine="6"/>
|
|
||||||
</Position14>
|
|
||||||
<Position15>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="27" Column="44" TopLine="8"/>
|
|
||||||
</Position15>
|
|
||||||
<Position16>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="30" Column="26" TopLine="15"/>
|
|
||||||
</Position16>
|
|
||||||
<Position17>
|
|
||||||
<Filename Value="E:\lazarus26r2.2.2.2\fpc\2.2.2\source\rtl\inc\wstringh.inc"/>
|
|
||||||
<Caret Line="85" Column="52" TopLine="74"/>
|
|
||||||
</Position17>
|
|
||||||
<Position18>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="27" Column="19" TopLine="6"/>
|
|
||||||
</Position18>
|
|
||||||
<Position19>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="24" Column="25" TopLine="14"/>
|
|
||||||
</Position19>
|
|
||||||
<Position20>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="23" Column="5" TopLine="15"/>
|
|
||||||
</Position20>
|
|
||||||
<Position21>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="32" Column="41" TopLine="22"/>
|
|
||||||
</Position21>
|
|
||||||
<Position22>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="33" Column="1" TopLine="22"/>
|
|
||||||
</Position22>
|
|
||||||
<Position23>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="16" Column="1" TopLine="11"/>
|
|
||||||
</Position23>
|
|
||||||
<Position24>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="32" Column="1" TopLine="21"/>
|
|
||||||
</Position24>
|
|
||||||
<Position25>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="33" Column="39" TopLine="22"/>
|
|
||||||
</Position25>
|
|
||||||
<Position26>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="37" Column="9" TopLine="22"/>
|
|
||||||
</Position26>
|
|
||||||
<Position27>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="33" Column="1" TopLine="22"/>
|
|
||||||
</Position27>
|
|
||||||
<Position28>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="13" Column="30" TopLine="2"/>
|
|
||||||
</Position28>
|
|
||||||
<Position29>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="15" Column="3" TopLine="1"/>
|
|
||||||
</Position29>
|
|
||||||
<Position30>
|
|
||||||
<Filename Value="ws_client.pas"/>
|
|
||||||
<Caret Line="11" Column="4" TopLine="11"/>
|
|
||||||
</Position30>
|
|
||||||
</JumpHistory>
|
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="8"/>
|
<Version Value="8"/>
|
||||||
|
@ -7,7 +7,7 @@ uses
|
|||||||
cthreads, cwstring,
|
cthreads, cwstring,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Classes, SysUtils,
|
Classes, SysUtils,
|
||||||
service_intf, soap_formatter, synapse_http_protocol,
|
service_intf, soap_formatter, synapse_http_protocol, //synapse_tcp_protocol,
|
||||||
echo_service, echo_service_proxy;
|
echo_service, echo_service_proxy;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -21,8 +21,10 @@ var
|
|||||||
c : Integer;
|
c : Integer;
|
||||||
begin
|
begin
|
||||||
SYNAPSE_RegisterHTTP_Transport();
|
SYNAPSE_RegisterHTTP_Transport();
|
||||||
|
//SYNAPSE_RegisterTCP_Transport();
|
||||||
|
|
||||||
locService := wst_CreateInstance_IEchoService('SOAP:','HTTP:','http://127.0.0.1:8000/services/IEchoService');
|
locService := wst_CreateInstance_IEchoService('SOAP:','HTTP:','http://127.0.0.1:8000/services/IEchoService');
|
||||||
|
//locService := wst_CreateInstance_IEchoService('SOAP:','TCP:Port=1234;Target=IEchoService;','127.0.0.1');
|
||||||
|
|
||||||
WriteLn('WST WideString Sample - Client');
|
WriteLn('WST WideString Sample - Client');
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ procedure TTCPTransport.SendAndReceive(ARequest, AResponse: TStream);
|
|||||||
Var
|
Var
|
||||||
wrtr : IDataStore;
|
wrtr : IDataStore;
|
||||||
buffStream : TMemoryStream;
|
buffStream : TMemoryStream;
|
||||||
strBuff : TBinaryString;
|
binBuff : TByteDynArray;
|
||||||
bufferLen : LongInt;
|
bufferLen : LongInt;
|
||||||
i, j, c : PtrInt;
|
i, j, c : PtrInt;
|
||||||
begin
|
begin
|
||||||
@ -122,10 +122,10 @@ begin
|
|||||||
wrtr.WriteAnsiStr(Target);
|
wrtr.WriteAnsiStr(Target);
|
||||||
wrtr.WriteAnsiStr(ContentType);
|
wrtr.WriteAnsiStr(ContentType);
|
||||||
wrtr.WriteAnsiStr(Self.Format);
|
wrtr.WriteAnsiStr(Self.Format);
|
||||||
SetLength(strBuff,ARequest.Size);
|
SetLength(binBuff,ARequest.Size);
|
||||||
ARequest.Position := 0;
|
ARequest.Position := 0;
|
||||||
ARequest.Read(strBuff[1],Length(strBuff));
|
ARequest.Read(binBuff[1],Length(binBuff));
|
||||||
wrtr.WriteAnsiStr(strBuff);
|
wrtr.WriteBinary(binBuff);
|
||||||
buffStream.Position := 0;
|
buffStream.Position := 0;
|
||||||
wrtr.WriteInt32S(buffStream.Size-4);
|
wrtr.WriteInt32S(buffStream.Size-4);
|
||||||
|
|
||||||
@ -144,11 +144,11 @@ begin
|
|||||||
i := 1024;
|
i := 1024;
|
||||||
if ( i > bufferLen ) then
|
if ( i > bufferLen ) then
|
||||||
i := bufferLen;
|
i := bufferLen;
|
||||||
SetLength(strBuff,i);
|
SetLength(binBuff,i);
|
||||||
repeat
|
repeat
|
||||||
j := FConnection.RecvBufferEx(@(strBuff[1]),i,DefaultTimeOut);
|
j := FConnection.RecvBufferEx(@(binBuff[1]),i,DefaultTimeOut);
|
||||||
FConnection.ExceptCheck();
|
FConnection.ExceptCheck();
|
||||||
AResponse.Write(strBuff[1],j);
|
AResponse.Write(binBuff[1],j);
|
||||||
Inc(c,j);
|
Inc(c,j);
|
||||||
i := Min(1024,(bufferLen-c));
|
i := Min(1024,(bufferLen-c));
|
||||||
until ( i =0 ) or ( j <= 0 );
|
until ( i =0 ) or ( j <= 0 );
|
||||||
|
@ -99,7 +99,7 @@ end;
|
|||||||
|
|
||||||
function TClientHandlerThread.ReadInputBuffer(): Integer;
|
function TClientHandlerThread.ReadInputBuffer(): Integer;
|
||||||
var
|
var
|
||||||
strBuff : TBinaryString;
|
binBuff : TByteDynArray;
|
||||||
bufferLen : LongInt;
|
bufferLen : LongInt;
|
||||||
i, j, c, readBufferLen : PtrInt;
|
i, j, c, readBufferLen : PtrInt;
|
||||||
begin
|
begin
|
||||||
@ -119,11 +119,11 @@ begin
|
|||||||
i := 1024;
|
i := 1024;
|
||||||
if ( i > bufferLen ) then
|
if ( i > bufferLen ) then
|
||||||
i := bufferLen;
|
i := bufferLen;
|
||||||
SetLength(strBuff,i);
|
SetLength(binBuff,i);
|
||||||
repeat
|
repeat
|
||||||
j := FSocketObject.RecvBufferEx(@(strBuff[1]),i,DefaultTimeOut);
|
j := FSocketObject.RecvBufferEx(@(binBuff[1]),i,DefaultTimeOut);
|
||||||
FSocketObject.ExceptCheck();
|
FSocketObject.ExceptCheck();
|
||||||
FInputStream.Write(strBuff[1],j);
|
FInputStream.Write(binBuff[1],j);
|
||||||
Inc(c,j);
|
Inc(c,j);
|
||||||
if ( ( bufferLen - c ) > 1024 ) then
|
if ( ( bufferLen - c ) > 1024 ) then
|
||||||
i := 1024
|
i := 1024
|
||||||
@ -173,7 +173,8 @@ procedure TClientHandlerThread.Execute();
|
|||||||
var
|
var
|
||||||
wrtr : IDataStore;
|
wrtr : IDataStore;
|
||||||
rdr : IDataStoreReader;
|
rdr : IDataStoreReader;
|
||||||
buff, trgt,ctntyp, frmt : TBinaryString;
|
trgt,ctntyp, frmt : TBinaryString;
|
||||||
|
buff : TByteDynArray;
|
||||||
rqst : IRequestBuffer;
|
rqst : IRequestBuffer;
|
||||||
i : PtrUInt;
|
i : PtrUInt;
|
||||||
begin
|
begin
|
||||||
@ -196,10 +197,11 @@ begin
|
|||||||
trgt := rdr.ReadAnsiStr();
|
trgt := rdr.ReadAnsiStr();
|
||||||
ctntyp := rdr.ReadAnsiStr();
|
ctntyp := rdr.ReadAnsiStr();
|
||||||
frmt := rdr.ReadAnsiStr();
|
frmt := rdr.ReadAnsiStr();
|
||||||
buff := rdr.ReadAnsiStr();
|
buff := rdr.ReadBinary();
|
||||||
rdr := nil;
|
rdr := nil;
|
||||||
FInputStream.Size := 0;
|
FInputStream.Size := 0;
|
||||||
FInputStream.Write(buff[1],Length(buff));
|
FInputStream.Write(buff[1],Length(buff));
|
||||||
|
SetLength(buff,0);
|
||||||
FInputStream.Position := 0;
|
FInputStream.Position := 0;
|
||||||
rqst := TRequestBuffer.Create(trgt,ctntyp,FInputStream,FOutputStream,frmt);
|
rqst := TRequestBuffer.Create(trgt,ctntyp,FInputStream,FOutputStream,frmt);
|
||||||
rqst.GetPropertyManager().SetProperty(sREMOTE_IP,FSocketObject.GetRemoteSinIP());
|
rqst.GetPropertyManager().SetProperty(sREMOTE_IP,FSocketObject.GetRemoteSinIP());
|
||||||
@ -211,7 +213,8 @@ begin
|
|||||||
FOutputStream.Read(buff[1],i);
|
FOutputStream.Read(buff[1],i);
|
||||||
FOutputStream.Size := 0;
|
FOutputStream.Size := 0;
|
||||||
wrtr := CreateBinaryWriter(FOutputStream);
|
wrtr := CreateBinaryWriter(FOutputStream);
|
||||||
wrtr.WriteAnsiStr(buff);
|
wrtr.WriteBinary(buff);
|
||||||
|
SetLength(buff,0);
|
||||||
SendOutputBuffer();
|
SendOutputBuffer();
|
||||||
ClearBuffers();
|
ClearBuffers();
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user