Jump to content

Fr0sT.Brutal

Members
  • Content Count

    2268
  • Joined

  • Last visited

  • Days Won

    46

Everything posted by Fr0sT.Brutal

  1. Fr0sT.Brutal

    Correct way of using LineMode?

    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.
  2. Fr0sT.Brutal

    How to use Open Street Maps with Delphi - cross platform?

    I made open-source Delphi VCL / Lazarus LCL component here. Currently not much features but usable
  3. Fr0sT.Brutal

    Correct way of using LineMode?

    I see. Interface is not too friendly for extending so I tend to create a wrapper class with socket as a field.
  4. Fr0sT.Brutal

    Correct way of using LineMode?

    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.
  5. Fr0sT.Brutal

    Correct way of using LineMode?

    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.
  6. Fr0sT.Brutal

    Parse and Log method parameters

    Yep, sure. You'll have to call LogMethod with string representations of these types.
  7. Fr0sT.Brutal

    Parse and Log method parameters

    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
  8. Fr0sT.Brutal

    Correct way of using LineMode?

    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
  9. Fr0sT.Brutal

    Parse and Log method parameters

    array of const 😉 Just like Format(). Inside the method you get array of TVarData IIRC
  10. Fr0sT.Brutal

    Parse and Log method parameters

    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
  11. Fr0sT.Brutal

    Extremely slow Link phase

    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.
  12. Fr0sT.Brutal

    HEIC library

    Freeware seems to have no problems... Anyway patented formats suck.
  13. Fr0sT.Brutal

    HEIC library

    Tip: you can use h2pas app from FreePascal bundle to convert header automatically.
  14. Fr0sT.Brutal

    Any Stand-alone VCL Editors?

    Ehm... There's VclStyleDesigner.exe in RAD Studio distributive, isn't it what you're looking for?
  15. Fr0sT.Brutal

    Uses Clause Manager in Tree in r2809

    @PeterPanettone man you really mixing forum and WhatsApp.
  16. Fr0sT.Brutal

    IDE addin for project-wide uses clause report?

    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
  17. Fr0sT.Brutal

    Unit testing cross platform code

    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.
  18. Fr0sT.Brutal

    The beauty of class and record helpers

    Then you'd better keep away from JavaScript ;)))
  19. Fr0sT.Brutal

    The beauty of class and record helpers

    The constructions are not "ugly", they are just a class methods, understandable, clear and having no side-effects.
  20. Fr0sT.Brutal

    SChannel TLS - perform TLS communication with WinAPI

    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.
  21. Fr0sT.Brutal

    SChannel TLS - perform TLS communication with WinAPI

    Uploaded new version with many fixes
  22. Fr0sT.Brutal

    SChannel TLS - perform TLS communication with WinAPI

    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.
  23. Fr0sT.Brutal

    Best components for creating windows service apps

    Wow, now I see it. The left column was completely overlooked by me. That's apparently an evil conspiracy of Google against Delphi!
  24. Fr0sT.Brutal

    SChannel TLS - perform TLS communication with WinAPI

    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.
  25. Fr0sT.Brutal

    Unit testing cross platform code

    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.
×