Jump to content

Angus Robertson

Members
  • Content Count

    2061
  • Joined

  • Last visited

  • Days Won

    38

Posts posted by Angus Robertson


  1. This problem is with the new library packages I produced for ICS v9, not v10, to allow fixing Posix bugs in ICS v9.  Specifically using Lib suffix: $(Auto) to avoid compiler specific packages. 

     

    I fixed several Android bugs with the older library, but can no longer build Android or Linux with the new library.  So IcsAndroidD110.dproj was OK, IcsAndroid.dproj gives the overload error.  Both are in the SVN, the newer one is not yet zipped, pending a lot of other package changes. 

     

    Angus


  2. ICS has an old experimental Linux package that used to build without errors. 

     

    I created a new Linux package, but this gives dozens of "Previous declaration was not marked with the 'overload' directive" errors.  Is there a compiler directive or something I've missed for the new package?  Ditto the Android package. 

     

    Angus

     


  3. Quote

    I mean, byte arrays exist in Delphi 7

    Correct, and ICS has always used byte arrays in low level functions, the MD5 digest is a byte array, although the Sha1 digest is an AnsiChar array since it was contributed. 

     

    But there were no TBytes library functions in Delphi 20 years old, so AnsiString was commonly used.  I've added a lot of TBytes  functions to ICS in the last few years so that support for old compilers has continued, and a TBytes version of Base64 conversion recently.  But old code only gets modernised when updated for some reason. 

     

    Angus

     


  4. This Websocket client problem should be fixed in SVN and the overnight zip, assuming it was an ANSI/Unicode casting problem with non-English character set conversions, which I'm unable to reproduce.  It did not affect Websocket server which had no casting, and yet always worked against our client. 

     

    The real problem is ICS has overloaded versions of many functions for ANSI and Unicode, and the compiler does not always choose the correct version if input and output parameters don't match, fixed by using a specific ANSI function.  I'm slowly adding TBytes versions for binary data to avoid such problems.  but it's a long job. 

     

    Angus

     

    • Like 1

  5. ICS has a new component TIcsNeighbDevices that builds a historic LAN neighbourhood MAC device and IP address table that shows MAC vendor name to help identify devices.   Runs in a thread continually checking for new devices.  ICS can be installed from Getit.

     

    To test it, build the ICS Network Tools sample, it's very similar to the excellent Nirsoft Wireless Network Watcher tool I've run continually for a decade to monitor my LAN.

     

    Angus


  6. The new Websocket API is live, when using streamlined requests, it handles about 100 SQL queries a minute from a single thread, although slower if the requests are sent sequentially waiting for a reply. 

     

    Supporting JSON-RPC 2.0 on the server should not be hard, but does need POST support, I'll look at adding it to the ICS web server database sample.  Client is a little harder since JSON-RPC 2.0 JSON-RPC uses a sequential ID to keep track of requests.

     

    Angus

     


  7. Quote

     persistent HTTP connections

    No idea why this client is not using keep-alive, perhaps their REST library does not support it? 

     

    The basic Websocket API is working, and the client can access another Websocket interface on the server so seem to know their stuff, now just need to design the pipelining, so that queued queries get returned to the correct client.

     

    I'll look at JSON-RPC 2.0 for next time.  

     

    Angus

     


  8. Digital certificates are sometimes distributed on USB tokens precisely to stop them being copied by software applications.  ICS can only access private keys that are stored in local windows store. 

     

    The USB token is not a simple storage device, it has an operating system that allows applications to pass data to the token, which is then signed by the private key and passed back to the application as a hash.  This signing is normally done by a Windows or OpenSSL API, and they need to be aware of the token and use that instead.   All token suppliers provide drivers that allow Windows applications to use their tokens, but not usually for OpenSSL. 

     

    OpenSSL needs extra code to access USB tokens, in the obsolete versions it was called an engine, with 3.0 and later it's called a provider, but it's just another DLL.  I understand there are OpenSSL providers to allow use signing with USB tokens, but they are supplied as C source code not Windows DLLs, and I've never tried any.  

     

    Integrating such a provider into ICS would not be quick, or maybe some-one has done it already?

     

    Angus

     


  9. Thanks for the comment, yes record ending is important, since this API has simple URL encoded arguments a single CRLF will be fine.  In fact, allowing multiple requests in a single message is probably what is really needed.  This client tends to do 10,000 odd requests in a single block during the night, takes about 25 minutes at the moment, single server thread, with a new session each time, eight per second. Will need to decide how many requests can be queued, in case they decide to try 1 million. 

     

    The responses do include the main argument, ie {"success":true,"reccount":16,"records":[{"number":"118118","number_from":"2010-03-10", etc. I should add the API type to the outer wrapper.  Then send them back one message at a time.  

     

    Either the server or client can ping/pong to keep the connection open, I was planning on the server doing that to avoid complexity at the client, they simply close the connection when the batch is over.

     

     Angus

     

    • Like 1

  10. I offer clients a REST API service to look-up telecommunication information, using the ICS web application server and MS SQL server. 

     

    It works well, for low volumes of queries, but most users start a new SSL/TLS session for each query, which becomes a limiting factor with performance. 

     

    So I want to offer a Websocket API as well, so one SSL/TLS session stays open, with just simple request/response packets sent. 

     

    But how to adapt the REST HTTP request/response to Websocket?  My queries are simple URL parameters, ie codelookapi.htm?numhistory=118118.

     

    Should the Websocket message just be the arguments or include the full or partial URL as well?  Or something else, like a command? 

     

    Should the initial Websocket request allow arguments, or just open the connection? 

     

    Should be Websocket response message be just a JSON block, or include a wrapper of some sort, like the HTTP response header? 

     

    Has anyone done a similar design?  I just want to make it easy for clients using standard Websocket client libraries to integrate the new API.

     

    Angus

     


  11. Quote

    Nice thing with async networking is that you can start many connections simultaneously and react for connection/timeout in event handlers.

    Indeed, no need for threads in ICS. 

     

    But Windows uses a thread to connect a TCP socket, and typically waits 30 to 40 seconds for a response before the Close event is called with an error, you can not abort it earlier.  So the socket can not be re-used for another connection immediately, unlike ICMP.   If you are checking a lot of hosts, you need a socket pool where they are not re-used until closed by Windows. 

     

    Angus

     

    • Like 1

  12. You have already discovered two reasons why TCP ping is unreliable, you need a remote open port and TCP timeouts are horrible to work around, that is why everyone uses ICMP ping which is 100 times more useful. 

     

    If you want to persist with TCP (why???) you should be using the TIcsIpStrmLog component, with the OverbyteIcsIpStmLogTst sample, try to connect to your TCP address and port as TCP Client, there are various setting you can change.  

     

    That component is used for similar purposes in other places in ICS, despite the name, it is really a high level version of WSocket that can be used as a client or server for TCP or UDP, sending data between instances of itself or other applications. 

     

    Angus

     

     


  13. As the others have said, TCP ping does not exist, you can try and open a specific TCP port at an IP address, but Windows has a long timeout while this is attempted and the socket can not be reused until that is over, so it's slow, and you need lots of parallel sockets to make it work, and hope some ports are open. 

     

    Build the ICS Network Tools sample that got added to ICS V9, the LAN Devices tab uses a new component that scans ranges of IPv4 and IPv6 addresses for devices, using APR, Neighbourhood IPs and pings, and builds a table with host names, MAC addresses and vendor, etc. 

     

    It's very similar to the excellent Nirsoft Wireless Network Watcher tool I've run continually for a decade to monitor my LAN.

     

    Angus

     

     

     

     

     

×