CodeRunner Documentation


The configuration file for CodeRunner is simply a INI style of file. Where you have [sections] and tuples (key=value). There are basically two different "sections", the first specifies how many of the 2nd exist.
That section tells CodeRunner to spawn to internal DXSock Generic Servers. Next, you will find a section for each server [Listener#]
Those are the specifications for the first Listener. It will bind to all IP addresses, and listen on port 110 (standard for POP3 Email Server). It will not use Blocking socket calls, nor will it work in burst mode (Nagle Algorithm), instead it will operate in a more "chattery" fashion called character mode. The next definition looks like:
Those are the specifications for the second Listener. It also will bind to all IP addresses, and listen on port 25 (standard SMTP Email Server). Again, I am not going to use Blocking socket calls, and I will run in character mode. Once this is saved, you simply launch the CodeRunner binary and depending upon your OS and setup, you should see:
Starting Server on port 110
Starting Server on port 25

Possible Settings per Listener

If unspecified, the listener will default to (all IP addresses, including Public, Private, and Loopback). CodeRunner is capable of running different scripts on different IP addresses. This allows you to have one version for your Intranet, and another for the public. And because you can EnableEncryption() in your script - you can make one script use encryption (or a different) encryption than its sibling on the same port for Intranet vs Internet.

A listener is one endpoint of a two-way communication link between two programs running on the network. A listener is bound to a port number so that the TCP/IP layer can identify the application that data is destined to be sent to. An endpoint is a combination of an IP address and a port number.

Ports are 16-bit numbers, therefore the maximum number of connections any given client can have to any given host port is 64K.
In TCP/IP, the keepalive is the administrative packet sent to detect a stale connection. In HTTP, keepalive means the persistent connection state and has nothing to do with this parameter. ... Keep-alive packets happen at the hardware layer, and MUST only be sent when no data or acknowledgment packets have been received for the connection within an interval.
A listener is in blocking mode when an I/O call waits for an event to complete. ... Some APIs, in addition to nonblocking calls, support asynchronous socket calls which is totally different that Blocking Off. The default mode of socket calls is blocking. A blocking call does not return to your program until the event you requested has been completed.
The Nagle algorithm is designed to reduce network traffic by causing the socket layer to buffer small packets and then combine them and send them as one packet under certain circumstances. A TCP/IP packet consists of 40 bytes of the header plus the data being sent.
The OnConnect option needs to be a full path and filename of the script which the Modern Pascal script engine will execute. This script is not loaded for execution until all of the socket layer negotiations have completed. The commercial version of CodeRunner does pre-compile a script to slightly improve performance. However, your clients will only notice the difference in an extremely busy environment.

The latest 2019 build has introduced a debug log which is generated automatically, and stores the timestamp, local Computer Name, the ProcessID, and Thread ID for each script it is executing. This new debug log is found in /var/log (or C:\VAR\LOG\) and is called coderunner. This was introduced to help new developers debug their online code - it will report the same filename, line number and column run-time (or compile-time) error message that the command line MP script engine does.