Recent

Author Topic: [Solved]Help needed with IdTcpClient...  (Read 542 times)

cdbc

  • Hero Member
  • *****
  • Posts: 1835
    • http://www.cdbc.dk
[Solved]Help needed with IdTcpClient...
« on: January 12, 2025, 03:34:35 pm »
Hi
Struggling wit Indy 10.6xxx
Am I stupid or just really slooowww?!?
How come, that when I receive an ACK of 4 bytes = (#20,#2,#0,#0), Indy insists on /stuffing/ the same amount of #0-bytes into my buffer before
my /real/ bytes?!?
I simply cannot understand it  %) Is it 'Endianness' or something else I've overlooked?
Any help will be deeply appreciated  :)
Btw: this is my recv-code:
Code: Pascal  [Select][+][-]
  1. //      fSock.IOHandler.ReadBytes(fInBuf,-1{fInBufLen});
  2.       fSock.IOHandler.InputBuffer.ExtractToBytes(fInBuf,-1{fInBufLen});
Regards Benny
« Last Edit: January 12, 2025, 10:55:07 pm by cdbc »
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

Thaddy

  • Hero Member
  • *****
  • Posts: 16520
  • Kallstadt seems a good place to evict Trump to.
Re: Help needed with IdTcpClient...
« Reply #1 on: January 12, 2025, 05:04:58 pm »
Internet protocols are BigEndian, that may indeed be the case.
Network byte order is BigEndian, hence we have the functions:
- BEtoN
- LEtoN
- NtoBE
- NtoLE
where LE is little endian and BE is big endian, all in unit system.
These transparently translate between the byte order - LE or BE - independent of systems.
They are more or less duplicated on some platforms in the sockets and/or windows unit.
You probably want https://www.freepascal.org/docs-html/rtl/system/beton.html

Note that, unless you operate on a very,very low level, this is likely already taken care of in the next higher level protocol abstractions. Look at the example code for the TCP client/server in the fcl-net directory.
« Last Edit: January 12, 2025, 05:15:50 pm by Thaddy »
But I am sure they don't want the Trumps back...

cdbc

  • Hero Member
  • *****
  • Posts: 1835
    • http://www.cdbc.dk
Re: Help needed with IdTcpClient...
« Reply #2 on: January 12, 2025, 06:01:02 pm »
Hi
Thanks mate, you made me look in the right place  ;D
Lots of clever mechanics inside 'Indy' and I was indeed operating on too low a level...  %)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

 

TinyPortal © 2005-2018