1. First checks
- Both drivers are optional. They are part of the engine only if it was built with the CMake option
INCLUDE_INETSERVER(OFF by default; it addsINETDriverandINETServerDrivertogether). - Try the same request outside the engine first, from the engine PC:
curl -v http://<IP>:<port>/<URL>(orInvoke-WebRequestin PowerShell), andTest-NetConnection <IP> -Port <port>. If that fails, the problem is the network / server, not the driver. - Read the start-up report:
INETDriver: Stream '<name>' Init driver.(client) orINETServerDriver: Server running on port <port>(server) tells you the driver started. - Always set
protocol,IPandportin thedriverblock: a missing field is not given a default value by the code. - Remember what the driver does and does not do (section 3): the stream itself does not receive data from a server; requests are issued from user code (models / hooks).
2. Message reference
<name> is the stream name.
| Message | Cause | What to do |
|---|---|---|
INETDriver: Stream '<name>' Init driver. (info) | The libcurl handle was created. | Normal. |
INETDriver: Stream '<name>' Init driver failed (error) | libcurl could not create its easy handle (out of memory, or libcurl / its TLS or SSH dependency is not usable). Every later request returns failure. | Make sure the libcurl shared libraries (and their TLS dependencies) belong to the build and are next to the executable. Restart the engine. |
INETServerDriver: Stream '<name>' Init driver. (info) | The HTTP server environment was initialized. | Normal. |
INETServerDriver: Server running on port <port> (info) | The HTTP server thread is listening on IP:port. | Normal. |
INETServerDriver: Error creating Server on <IP>:<port>. (error) | The server could not start: the port is already used (another program, another CoreEngine, another INET server stream), IP is not an address of this PC or is empty / invalid, or the port needs administrator rights. | Check netstat -ano -p tcp | findstr :<port>. Use 0.0.0.0 (all adapters) or the NIC address from ipconfig. Use a port above 1024. Only one INET server per application is supported (see below). |
INETServerDriver: Server on port <port> Stoped. (info, spelling as in the code) | The server stopped (engine stop / exit). | Normal. |
No message at all is the usual symptom of a failed request: when a libcurl call fails (cannot resolve or connect, timeout, TLS error, malformed URL) the client driver returns a failure result to the caller and prints nothing.
The libcurl error text is not shown. Reproduce with curl -v to see it.
3. What the driver actually does
| Item | Behaviour in the current source | What it means for you |
|---|---|---|
INETDriver configuration | Reads protocol, IP, port, URL and the header object. A URL without a leading / gets one. The header values are read as strings. | All header values must be JSON strings ("Accept": "text/json"); a number or boolean is not a string and can make the configuration load fail. Do not put a scheme or host in URL; those come from protocol, IP, port. |
| HTTP headers | Set at start-up when protocol begins with http (so http and https). Not set for sftp. | A typo such as "htp" means no custom headers and a broken URL. |
| Full URL | User code calling the driver's Post(text, params, response) gets <protocol>://<IP>:<port><URL>, with {1} in URL replaced by params. The response body is collected into the response string. | Use the placeholder {1} for the variable part of the endpoint. |
| Stream send / receive | The generic stream Send of this driver posts the block to the configured URL only (relative, without scheme / host / port). Get(...) also uses only the relative URL. The driver's Recv and the stream's ReadMsg do nothing, so input blocks of an INET stream are never filled. | Do not expect "direction": "in" blocks to update. Drive the requests from a model or hook that calls Post, and read the response there. A failed generic send returns failure silently. |
| Time-outs | No connect or transfer time-out is set in the code, so libcurl's own defaults apply (a connect to an unreachable host can wait a long time). | An unreachable server blocks the calling code, which can cause minor-frame overruns. Keep requests out of the real-time minor frame (own thread / low rate) and check the server before starting. |
| Proxy / certificates | No proxy is configured in the code (libcurl honours the usual http_proxy / https_proxy environment variables). The SetupHTTPS(skipPeer, skipHost) helper switches certificate verification off when its argument is false, and its return value is always CURLE_FAILED_INIT. | If a local server (127.0.0.1) is reached through a proxy, set NO_PROXY=127.0.0.1,localhost. For HTTPS with a self-signed certificate see section 5. |
INETServerDriver configuration | Reads protocol, IP, port. The server listens on IP:port (IPv4). | The protocol value is not used to choose the server type: it is always plain HTTP. |
| Server endpoints | User code registers handlers with AddGETEndpoint(path, handler) / AddPOSTEndpoint(path, handler). Unknown GET paths answer 404 Not Found, unknown POST paths answer 404 POST route not found. A match is the exact path without the leading / (user for /user). The handler receives the path and fills the answer; the POST body is not passed to it. | A 404 means the endpoint was not registered or the path differs (case, extra /, query string). |
| Server start order | The server and its controller are created in a separate thread after the driver is initialized. AddGETEndpoint / AddPOSTEndpoint return false until that controller exists. | If endpoint registration returns false, register after the server is running (the Server running on port line has appeared), or retry. |
| One server per process | The source comments state that two of these server threads can not run concurrently in one application. | Use one INETServerDriver stream per CoreEngine and put all endpoints in it. |
4. Network checklist
- Client cannot connect: wrong
IP/port, the server is not running, wrong subnet, or the server's firewall blocks the port. UseTest-NetConnection <IP> -Port <port>(TcpTestSucceeded : Trueis required). A host name inIPdepends on DNS; prefer the numeric address. - Server not reachable from other PCs:
IPis127.0.0.1(local only), or the Windows firewall blocks the inbound port. Use0.0.0.0or the NIC address and allow the port (administrator PowerShell):
Linux:New-NetFirewallRule -DisplayName "CoreEngine INET server 8080" -Direction Inbound -Protocol TCP -LocalPort 8080 -Action Allow -Profile Anysudo ufw allow 8080/tcp. - Port in use:
netstat -ano -p tcp | findstr :<port>shows the owning process id. - Wrong HTTP details: wrong
Content-Type/Acceptheaders make many servers answer 400 / 415; check the exact path including the leading/; check for the extra/betweenIP:portandURL. - Slow or blocked real-time loop: HTTP requests are synchronous and take milliseconds to seconds. Do not send them every minor frame.
5. Other problems
| Symptom | Cause | Fix |
|---|---|---|
Driver name INETDriver / INETServerDriver is unknown | The engine was built without INCLUDE_INETSERVER. | Rebuild with -DINCLUDE_INETSERVER=ON. |
| The stream loads but input blocks never change | Receiving is not implemented in the stream (see section 3). | Request the data from a model / hook with Post and process the response there. |
| Requests never reach the server and there is no message | The failure of the libcurl call is not reported; typical reasons: wrong protocol, IP or port, relative URL used for a generic send, server down. | Reproduce with curl -v; check all three driver fields; use the full-URL Post from user code. |
| Startup is slow or the engine stalls on the first request | Connect to an unreachable host: no time-out configured. | Fix the address; verify the server first; send from a non-real-time thread. |
| HTTPS: certificate error | Self-signed / unknown CA, or the server name does not match the certificate. | Install the CA on the PC and use the host name from the certificate, or use plain http on a closed test network. Remember that SetupHTTPS(false, false) disables the verification (insecure). |
sftp does not work | libcurl must be built with SSH support; the headers are not applied for sftp; credentials are not part of the driver fields. | Check that your libcurl build lists sftp (curl -V); test with curl -u user sftp://... first. |
| Server answers 404 for a known endpoint | Endpoint not registered (registration returned false because the server was not up yet), or path differs. | Register after Server running; the path is matched exactly without the leading /. |
| Server answers but the content is empty or wrong | The handler did not fill the response string, or the POST body is expected but is not passed to the handler. | Check the handler code; put the data in the URL or use GET. |
| Second INET server stream does not start / the application behaves strangely | Only one server thread per application is supported. | Use one stream. |
| Server stops answering after the engine reset | The server thread is stopped on engine stop and started on init; the old port may still be in use for a moment. | Wait a few seconds; if Error creating Server remains, check for a leftover process on the port. |
Message counters and error counters of every block are visible live in
System Layout. For plain UDP / TCP links see the socket drivers page; to look at the HTTP packets on the wire use the Sniffer driver or Wireshark.