-
Content Count
2268 -
Joined
-
Last visited
-
Days Won
46
Everything posted by Fr0sT.Brutal
-
Correct way of using LineMode?
Fr0sT.Brutal replied to Fr0sT.Brutal's topic in ICS - Internet Component Suite
It is extendable in wsocket descendants so why not. I kinda had luck with SchannelSocket doing that so I decided to proceed with encapsulating protocol-specific stuff into socket class itself. Thanks Francois, I'm aware of it but that's something like HTTP that I want to implement. HTTP request was just the simplest one I found to use as a sample of line-based protocol. -
How to use Open Street Maps with Delphi - cross platform?
Fr0sT.Brutal replied to mawg's topic in FMX
I made open-source Delphi VCL / Lazarus LCL component here. Currently not much features but usable -
Correct way of using LineMode?
Fr0sT.Brutal replied to Fr0sT.Brutal's topic in ICS - Internet Component Suite
I see. Interface is not too friendly for extending so I tend to create a wrapper class with socket as a field. -
Correct way of using LineMode?
Fr0sT.Brutal replied to Fr0sT.Brutal's topic in ICS - Internet Component Suite
Well, actually to use library functionality is exactly what I'm trying to do! Alas, library doesn't seem to allow me this. Of course first calling inherited is logical - that's where bytes are received, lines are buffered where they will be then extracted from and so on. Okay. But after doing this I expect Receive to return line by line, right? But I get nothing. As far as I can understand the logic behind the code it relies heavily on the presence of OnDataAvailable handler and breaks if there's no any but of course I might be wrong. -
Correct way of using LineMode?
Fr0sT.Brutal replied to Fr0sT.Brutal's topic in ICS - Internet Component Suite
If I add a call to inherited function TLineTestSocket.TriggerDataAvailable(ErrCode: Word): Boolean; var s: RawByteString; begin Result := inherited; repeat s := ReceiveStrA; if s = '' then Break; MemoLog('Got line: '+ s); until True; end; I get nothing at all, ReceiveStrA returns empty string. -
Parse and Log method parameters
Fr0sT.Brutal replied to Mike Torrettinni's topic in RTL and Delphi Object Pascal
Yep, sure. You'll have to call LogMethod with string representations of these types. -
Parse and Log method parameters
Fr0sT.Brutal replied to Mike Torrettinni's topic in RTL and Delphi Object Pascal
function VarToStr(const VarRec: TVarRec): string; begin Result := ''; // compiler happy case VarRec.VType of vtInteger: Result := IntToStr(VarRec.VInteger); vtInt64: Result := IntToStr(VarRec.VInt64^); vtString: Result := string(VarRec.VString^); vtPChar: Result := string(VarRec.VPChar); vtPWideChar: Result := string(VarRec.VPWideChar); vtAnsiString: Result := string(AnsiString(VarRec.VAnsiString)); vtWideString: Result := string(WideString(VarRec.VWideString)); vtUnicodeString: Result := string(VarRec.VUnicodeString); vtChar: Result := Char(VarRec.VChar); vtWideChar: Result := VarRec.VWideChar; end; end; end; Something like what you need. Extracted from bigger function and edited in browser so bugs are possible -
Correct way of using LineMode?
Fr0sT.Brutal replied to Fr0sT.Brutal's topic in ICS - Internet Component Suite
Angus, thanks for reply. TCustomLineWSocket is in straight inheritance line so no problem here. I descend from TWSocket. I tried calling Receive which is almost the same as ReceiveStr from TriggerDataAvailable with no luck. procedure MemoLog(const msg: string); begin Form1.mLog.Lines.Add(msg); end; type TLineTestSocket = class(TWSocket) public Request: RawByteString; procedure TriggerSessionConnectedSpecial(ErrCode: Word); override; function TriggerDataAvailable(ErrCode : Word) : Boolean; override; end; { TLineTestSocket } procedure TLineTestSocket.TriggerSessionConnectedSpecial(ErrCode: Word); begin inherited; SendStr(Request); end; function TLineTestSocket.TriggerDataAvailable(ErrCode: Word): Boolean; var s: RawByteString; begin repeat s := ReceiveStrA; if s = '' then Break; MemoLog('Got line: '+ s); until True; end; procedure TForm1.Button1Click(Sender: TObject); var sock: TLineTestSocket; begin sock := TLineTestSocket.Create(Self); sock.LineMode := True; sock.Addr := 'google.com'; sock.Port := '80'; sock.Request := RawByteString('GET / HTTP/1.1'#13#10#13#10); sock.Connect; end; Here's an excerpt from test project. On execution I get: So either I'm not cooking ReceiveStrA properly or it doesn't do what it supposed to do -
Parse and Log method parameters
Fr0sT.Brutal replied to Mike Torrettinni's topic in RTL and Delphi Object Pascal
array of const 😉 Just like Format(). Inside the method you get array of TVarData IIRC -
Parse and Log method parameters
Fr0sT.Brutal replied to Mike Torrettinni's topic in RTL and Delphi Object Pascal
You hardly need to print parameter names every time IMHO. So you can use general LogMethod('MethodA', [par1, par2, par3]); and create a code template for this. There would remain some manual work though -
Before doing any changes in this direction, compare times of Rebuilding with Shift-F9 and Compiling with Ctrl-F9. The latter is almost purely link time. Probably build time is not a problem.
-
Freeware seems to have no problems... Anyway patented formats suck.
-
Tip: you can use h2pas app from FreePascal bundle to convert header automatically.
-
Ehm... There's VclStyleDesigner.exe in RAD Studio distributive, isn't it what you're looking for?
-
@PeterPanettone man you really mixing forum and WhatsApp.
-
IDE addin for project-wide uses clause report?
Fr0sT.Brutal replied to PeterPanettone's topic in Delphi IDE and APIs
Pascal analyzer can do this (it has free lite version) The metric is under Reports > Reference > Uses Alternatively, there's delphiunitsizes tool that grabs list of used units from the binary -
Just a side note: I personally find very useful using CheckEqual methods instead of plain Check as they print both values in case of error which helps to find a concrete test that fails.
-
The beauty of class and record helpers
Fr0sT.Brutal replied to Rollo62's topic in RTL and Delphi Object Pascal
Then you'd better keep away from JavaScript ;))) -
The beauty of class and record helpers
Fr0sT.Brutal replied to Rollo62's topic in RTL and Delphi Object Pascal
The constructions are not "ugly", they are just a class methods, understandable, clear and having no side-effects. -
SChannel TLS - perform TLS communication with WinAPI
Fr0sT.Brutal replied to Fr0sT.Brutal's topic in I made this
Well, I won't reject PR's adding compatibility with ancient compilers but unlikely will do that myself. Some of introduced language features are too nice to ignore them. -
SChannel TLS - perform TLS communication with WinAPI
Fr0sT.Brutal replied to Fr0sT.Brutal's topic in I made this
Uploaded new version with many fixes -
SChannel TLS - perform TLS communication with WinAPI
Fr0sT.Brutal replied to Fr0sT.Brutal's topic in I made this
Yeah, it's buffering issue... AsyncReceive calls ioctl and breaks loop when there are no data in socket left but they are in internal buffer decrypted already. And dummy Recv(0) didn't launch a new FD_READ. I'm now trying posting FMsg_WM_ASYNCSELECT just like in HTTPTunnelSocket. -
Wow, now I see it. The left column was completely overlooked by me. That's apparently an evil conspiracy of Google against Delphi!
-
SChannel TLS - perform TLS communication with WinAPI
Fr0sT.Brutal replied to Fr0sT.Brutal's topic in I made this
Angus, I have no D2007 at hand but I'll try to keep compatibility. At least 2007 already has Default so it's worth to support :))) Well, the code is just a demo 😉 it's tuned for connect-request-response-close scheme, I have another setup where a data stream is received as well. As for cipher suites, Windows seems to have plenty - at least for me. -
Hmm, isn't a single code base for all platforms the main goal of cross-platform? I don't realize what's the problem in using testing framework on several platforms. Of course not talking about GUI runners but any other methods of test framework shouldn't care about platform at all.