Jump to content

Angus Robertson

Members
  • Content Count

    2061
  • Joined

  • Last visited

  • Days Won

    38

Everything posted by Angus Robertson

  1. Angus Robertson

    9.4 on C++ Builder 12.3

    Before I comment any further, can you please confirm you are using ICS from the overnight zip or icsv94.zip or SVN? ICSCommonCBNewDesign.cbproj should be dated February or March 2025, and contains the XML line: <BCC_UserSuppliedOptions> -r</BCC_UserSuppliedOptions> I don't see any -k. So it would appear you are working with some other version of ICS. Angus
  2. Angus Robertson

    Send data to the server

    The old OverbyteIcsHttpPost sample is for use with THttpCli. If you are using TSslHttpRest, the OverbyteIcsHttpRestTst sample includes several ways of uploading data. POST is simply a command, servers accept uploads in many different ways, since they usually need to know the file name and other information. Angus
  3. Angus Robertson

    9.4 on C++ Builder 12.3

    Thanks, I'll remove the -k flag. I was able to build V9,4 for D12.3 OK, but Embarcadero was not, which is why it's not in GetIt. For C++ Win64 old, I get four unresolved external errors I don't understand, and Win64 Modern fails completely because the compiler does not export the correct symbol files, reported last year but not fixed in D12.3, yet. Angus
  4. Angus Robertson

    ICS SmtpClient Mime Header Encode

    So you are saying that: Smtp.FromName := HdrEncodeInLineEx((MyStr, SpecialsRFC822, 'Q', CP_UTF8, 72, false); does not encode the name? It does seem the email samples don't actually use inline encoding, and perhaps it should be handled by the SMPT component, since we all use unicode compilers nowadays and expect strings to be converted properly. If I can make that work in a backward compatible way, I'll look at adding it to ICS. Angus
  5. Angus Robertson

    TCP Server + Client + Threaded and Bytes

    LineMode/LineEnd is normally only used for ASCII protocols with limited line lengths, ie HTTP/SMTP etc, The DataAvailable event should only be triggered by LineEnd, but might also be if the connection is closed, or maybe not. That was why I suggested the TIcsIpStrmLog componemt which has more options to avoid data being lost, but unfortunately not long LineEnds. But I'd still use it for your clients, unless the server also sends long LineEnds. Angus
  6. Angus Robertson

    TCP Server + Client + Threaded and Bytes

    You did not add LineEnd, so it never finds the end of your records. Angus
  7. Angus Robertson

    TCP Server + Client + Threaded and Bytes

    The TIcsIpStrmLog component can be configured for TCP or UDP. It can do file transfers, but has SendLogLine (const Line: TBytes) which is exactly what you requested. For clients, the component handles connection retries if/when the connection drops. Reading your message again, the record end of eight bytes is not handled, only a single symbol or CRLF, but you could easily adapt the component receive loop to check for a longer end of record. OverbyteIcsThrdSrv is a very old server sample and has not been tested for many years. Try OverbyteIcsSimpleSslServer, inSslWSocketServer1ClientConnect set a long LimieLimit and LineEnd to your six bytes. Ignore the SSL stuff. Angus
  8. Angus Robertson

    TCP Server + Client + Threaded and Bytes

    ICS sends binary data at the lowest level, it has methods to send strings and TBytes to make life easier for the developer. You need to be more cautious receive, in case of disconnection when your packet end is lost. I'd recommended building the OverbyteIcsIpStmLogTst sample, it uses the TIcsIpStrmLog component that is designed for simple data transfer like yours, it can be configured as a client or server to send and receive packets, the sample should interwork with your existing applications. TIcsIpStrmLog saves a lot of code over using the lower level components, should be working in a day. Angus
  9. Angus Robertson

    ICS SmtpClient Mime Header Encode

    Email headers are inline MIME encoded, using HdrEncodeInLine in the OverbyteIcsMimeUtils unit, there are a lot of options for character sets, Q or B encoding, and how to wrap or fold long lines. Look at the OverbyteIcsMimeDemo sample, this illustrates how to use HdrEncodeInLine and other similar MIME encoding and decoding functions. Angus
  10. Angus Robertson

    Subscribe to a topic with TIcsMQTTClient

    The onClientMsg event is only triggered for published messages, Sorry, don't know off hand which event is triggered to acknowledge subscribe, you'll need to check the source code. Angus
  11. Angus Robertson

    Subscribe to a topic with TIcsMQTTClient

    My Mosquitto log shows exactly that. 2025-03-21T12:51:02: Received SUBSCRIBE from CID64860 2025-03-21T12:51:02: update/memo (QoS 2) 2025-03-21T12:51:02: Sending SUBACK to CID64860 Angus
  12. Angus Robertson

    Subscribe to a topic with TIcsMQTTClient

    First place to look would be the Mosquitto log file, maybe subscribe failed for some reason. I did test the latest version against local and remote Mosquitto servers, but my knowledge of the MQTT protocol is almost nil so I don't know what to expect when I click the various test buttons. Angus
  13. Angus Robertson

    ICS - XX: The XX field is required

    ICS is simply reporting a REST API error that says your XML contains an error. So you need to correct your XML. Or maybe you are using the wrong API? Angus
  14. Angus Robertson

    Help with JWToken

    https://www.iana.org/assignments/jose/jose.xhtml and https://www.iana.org/assignments/jwt/jwt.xhtml are a good start to JOSE and JWT and the RFCs that explain the standards for the numerous possible names. Angus
  15. https://www.theregister.com/2025/04/14/ssl_tls_certificates/ https://www.feistyduck.com/newsletter/issue_124_certificate_lifetimes_to_shrink_to_just_forty_seven_days and numerous other sites that reported the same April vote, although https://cabforum.org/ has not yet been updated with the minutes of the meeting, or at least I can not find them. If you are interested in SSL/TLS, subscribe to the Feisty Duck monthly newsletter, it collects all the news. Angus
  16. Angus Robertson

    UDP bind...

    For TCP and UDP client, setting LocalAddr attempts to bind to that address, if it exists. But it's generally a bad idea for clients to set LocalAddr, since IP addresses can be dynamic and change, interfaces can also come and go while your application is running. ICS has a component IcsIpChanges that reports such changes so servers in particular can know the IP address they are using has disappeared. BTW, please do not repeat everything I write, this is a threaded forum, so long quotes simply wastes space. Angus
  17. Angus Robertson

    UDP bind...

    In what way was my response unclear? Angus
  18. Angus Robertson

    UDP bind...

    For UDP server, TWSocket Addr and Port are set for listening. For UDP client, TWSocket LocalAddr and LocalPort may be set but are usually left blank, the remote address and port are specified in the SendTo method when sending data. Angus
  19. Angus Robertson

    TWSocket,,,

    After doing a couple of tests, it seems the SO_BSP_STATE API returns the local address allocated to the socket, usually 0.0.0.0, rather than the address chosen by Windows. We do get the random local port, so that could be used with the IpHlpConnsTable function to get a list of all connections on the PC, and search for the remote IP and local port, to find the local IP, major overhead to get a few bytes. Angus
  20. Angus Robertson

    TWSocket,,,

    I'm sure you are correct, but a few spare bytes in a buffer might provide future proofing. I'm surprised Socket_Address has not been used for other APIs, Microsoft has so many of these similar but not quite the same structures. Fortunately, ICS has a simple function to convert PSockAddrIn6 into a string. Angus
  21. Angus Robertson

    TWSocket,,,

    I've just got this working with new types Socket_Address = record { V9.5 used to store an IPv4 or IPv6 address } Sockaddr: PSockAddrIn6; SockaddrLength: Integer; end; TSocketAddress = Socket_Address; CSADDR_INFO = record { V9.5 used to connection IP information } LocalAddr: TSocketAddress; { family, address and port } RemoteAddr: TSocketAddress; iSocketType: Integer; { SOCK_STREAM or SOCK_DGRAM } iProtocol: Integer; { IPPROTO_TCP or IPPROTO_UDP } Buffer: array[0..64] of Byte; { space for PSockAddrIn6 records } end; TCSAddrInfo = CSADDR_INFO; Need to ensure it handles all ways of connecting, and update a sample to show the result, hopefully later today. Angus
  22. Angus Robertson

    TWSocket,,,

    Sorry, no time to debug this at the moment. Angus
  23. Angus Robertson

    TWSocket,,,

    You should wait until the socket is connected before trying to get socket connected information, use the OnSessionConnected event. Angus
  24. Angus Robertson

    TWSocket,,,

    Generally, you set the LocalAddr, LocalAddr6 and SocketFamily to specify which of multiple IP addresses is to be used. Currently, TWSocket does not have any properties to show which IP address Windows choose for an outbound connection only for incoming listen connections. Windows Vista added a getsockopt of SO_BSP_STATE that should return the local and remote addresses and ports for a connection, but it is not used by ICS, you try it with the TSocket handle. I'll put it on my long term wish list, but we seem to have managed for a long time without knowing the real local address. Angus
  25. Set the component ResponseNoException property to true, and the exceptions are replaced by messages. This is a historical thing to not break old applications, but should probably default to true now. Angus
×