Kōtuku
  • Gallery
  • API
  • Wiki
  • GitHub
    •  Overview
    • AddressToStr()
    • HostToLong()
    • HostToShort()
    • LongToHost()
    • SetSSL()
    • ShortToHost()
    • StrToAddress()
    • Audio
    • Config
    • Core
    • Display
    • Document
    • Font
    • HTTP
    • Network
    • Regex
    • SVG
    • Tiri
    • Vector
    • XML
    • XQuery
    • XRandR
      • Audio
      • MP3
      • Sound
      • File
      • MetaClass
      • Module
      • StorageDevice
      • Task
      • Thread
      • Time
      • Compression
      • CompressedStream
      • Config
      • LZMAStream
      • Script
      • Tiri
      • XML
      • XQuery
      • Controller
      • BlurFX
      • ColourFX
      • CompositeFX
      • ConvolveFX
      • DisplacementFX
      • FilterEffect
      • FloodFX
      • ImageFX
      • LightingFX
      • MergeFX
      • MorphologyFX
      • OffsetFX
      • RemapFX
      • SourceFX
      • TurbulenceFX
      • WaveFunctionFX
      • Scintilla
      • Bitmap
      • Clipboard
      • Display
      • Document
      • Font
      • Image
      • Pointer
      • Surface
      • SVG
      • ClientSocket
      • HTTP
      • NetClient
      • NetLookup
      • NetServer
      • NetSocket
      • Proxy
      • Gradient
      • GradientConic
      • GradientContour
      • GradientDiamond
      • GradientDiffusion
      • GradientDistal
      • GradientGouraud
      • GradientLinear
      • GradientMesh
      • GradientRadial
      • GradientVoronoi
      • Vector
      • VectorClip
      • VectorColour
      • VectorEllipse
      • VectorFilter
      • VectorGradient
      • VectorGroup
      • VectorImage
      • VectorPath
      • VectorPattern
      • VectorPolygon
      • VectorRectangle
      • VectorScene
      • VectorShape
      • VectorSpiral
      • VectorText
      • VectorTransition
      • VectorViewport
      • VectorWave
      • Linux Builds
      • Windows Builds
      • Customising Your Build
      • Kōtuku Objects
      • Kōtuku In Depth
      • Kōtuku Design Patterns
      • Coding With AI
      • Regex Manual
      • XML Comparisons
      • Tiri Reference Manual
      • Config API
      • Defer Syntax
      • GUI API
      • HTTP Server API
      • I/O API
      • JSON API
      • OAuth API
      • Options API
      • Proxy Server API
      • Tempus API
      • URL API
      • VFX API
      • Widgets
      • RIPL Reference Manual
      • Origo
      • Flute / Unit Testing
      • Tuku
      • Embedded Document Format
      • TDL Reference Manual
      • TDL Tools
      • Action Reference Manual
      • System Error Codes

Network Module

Provides miscellaneous network functions and hosts the NetSocket, NetServer and ClientSocket classes.

The Network module exports a few miscellaneous networking functions. For core network functionality surrounding sockets and HTTP, please refer to the NetSocket, NetServer and HTTP classes.

Functions

AddressToStr | HostToLong | HostToShort | LongToHost | SetSSL | ShortToHost | StrToAddress

Structures

IPAddress

Classes

ClientSocket | NetClient | NetLookup | NetServer | NetSocket | Proxy

Constants

IPADDR | JET | JTYPE

AddressToStr()

Converts an IPAddress structure to an IPAddress in dotted string form.

ERR net::AddressToStr(struct IPAddress * IPAddress, STRING * Result)
ParameterDescription
IPAddressA pointer to the IPAddress structure.
ResultMust point to a std::string variable so that the resolved address can be stored.

Converts an IPAddress structure to a string containing the IPAddress in dotted format.

Error Codes

OkayThe IPAddress was converted successfully.
Network module documentation © Paul Manias © 2005-2026

HostToLong()

Converts a 32 bit (unsigned) long from host to network byte order.

UINT net::HostToLong(UINT Value)
ParameterDescription
ValueData in host byte order to be converted to network byte order

Converts a 32 bit (unsigned) long from host to network byte order.

Result

The long in network byte order

Network module documentation © Paul Manias © 2005-2026

HostToShort()

Converts a 16 bit (unsigned) word from host to network byte order.

UINT net::HostToShort(UINT Value)
ParameterDescription
ValueData in host byte order to be converted to network byte order

Converts a 16 bit (unsigned) word from host to network byte order.

Result

The word in network byte order

Network module documentation © Paul Manias © 2005-2026

LongToHost()

Converts a 32 bit (unsigned) long from network to host byte order.

UINT net::LongToHost(UINT Value)
ParameterDescription
ValueData in network byte order to be converted to host byte order

Converts a 32 bit (unsigned) long from network to host byte order.

Result

The Value in host byte order.

Network module documentation © Paul Manias © 2005-2026

SetSSL()

Alters SSL settings on an initialised NetSocket client object.

ERR net::SetSSL(objNetSocket * NetSocket, STRVIEW Command, STRVIEW Value)
ParameterDescription
NetSocketThe target NetSocket object.
CommandName of a command or option to set (case-sensitive, camel-case).
ValueValue to set for the command or option.

Use the SetSSL() function to adjust the SSL capabilities of a NetSocket client object. Server-side SSL is configured on NetServer before initialisation with the SSL flag and certificate fields. The following commands are currently available:

  • EnableSSL: Starts an SSL handshaking process with the remote server. Does nothing if the socket is already in SSL mode.
  • DisableSSL: Disconnects the SSL connection and reverts to unencrypted mode.

If a failure occurs when executing a command, the execution of all further commands is aborted and the error code is returned immediately.

SetSSL() can also be used to check if SSL is supported in the current build, in which case ERR::NoSecureSockets will be the return value if all other arguments are NULL.

Error Codes

OkayOperation successful.
RetrySSL handshaking needs to be retried.
FailedSSL setup or connection setup failed.
FieldNotSetSSL state was not initialised for the socket.
SystemCallThe SSL library or platform SSL backend reported a system-level failure.
DisconnectedSSL reported that the peer disconnected during handshaking.
NullArgsThe NetSocket argument was not specified.
WrongClassThe object is not a NetSocket.
WouldBlockSSL handshaking would block.
InputOutputSSL handshaking failed due to an I/O error.
NoSecureSocketsSSL support is disabled in this build.
Network module documentation © Paul Manias © 2005-2026

ShortToHost()

Converts a 16 bit (unsigned) word from network to host byte order.

UINT net::ShortToHost(UINT Value)
ParameterDescription
ValueData in network byte order to be converted to host byte order

Converts a 16 bit (unsigned) word from network to host byte order.

Result

The Value in host byte order

Network module documentation © Paul Manias © 2005-2026

StrToAddress()

Converts an IP Address in string form to an IPAddress structure.

ERR net::StrToAddress(STRVIEW String, struct IPAddress * Address)
ParameterDescription
StringA null-terminated string containing the IP Address in dotted format.
AddressMust point to an IPAddress structure that will be filled in.

Converts an IPv4 or an IPv6 address in string format to an IPAddress structure. The String must be of form 1.2.3.4 (IPv4) or 2001:db8::1 (IPv6). IPv6 addresses are automatically detected by the presence of colons.

struct IPAddress addr;
if (!StrToAddress("127.0.0.1", &addr)) {
   ...
}

Error Codes

OkayThe Address was converted successfully.
SyntaxThe String was not a valid IP Address.
NullArgsFunction call missing argument value(s)
Network module documentation © Paul Manias © 2005-2026

IPADDR Type

Address types for the IPAddress structure.

NameDescription
IPADDR::V4
IPADDR::V6
Network module documentation © Paul Manias © 2005-2026

JET Type

JET constants are documented in GetInputEvent()

NameDescription
JET::ABS_XYThe X, Y values are defined as absolute coordinates, relative to the top-left of the display
JET::BUTTON_1Left mouse button; XBox A button, PS square button. Value is pressure sensitive, ranging between 0 - 1.0 (0 is released, 1.0 is fully depressed)
JET::BUTTON_10Non-specific button assignment
JET::BUTTON_2Right mouse button; XBox X button, PS cross button
JET::BUTTON_3Middle mouse button; XBox Y button, PS triangle
JET::BUTTON_4Alt. mouse button 1; XBox B button, PS circle
JET::BUTTON_5Alt. mouse button 2
JET::BUTTON_6Non-specific button assignment
JET::BUTTON_7Non-specific button assignment
JET::BUTTON_8Non-specific button assignment
JET::BUTTON_9Non-specific button assignment
JET::CROSSED_INThis message is sent by the input system when the mouse pointer enters an area for the first time. The message value refers to the object ID of the container being monitored for movement
JET::CROSSED_OUTThis message is sent by the input system when the mouse pointer leaves an area. The message value refers to the object ID of the container being monitored for movement
JET::DEVICE_TILT_XYController tilted on the X/Y axis. Value indicates angle, -ve = left, +ve = right
JET::DEVICE_TILT_ZController is rising or falling. Value expressed as 'speed',
JET::DISPLAY_EDGERecently supplied input occurred at the edge of the display
JET::PEN_TILT_XYPen tilt angle. 0 is pointing down directly with nib at bottom, 0.5 is 90 degrees, 1.0 is inversed (eraser at bottom)
JET::PRESSUREAmount of pressure applied, ranges from 0 (none) to 1.0 (normal) and possibly higher if user presses hard enough
JET::WHEELMouse wheel rotation - the value generally reflects the number of 'clicks' rotated on the wheel
JET::WHEEL_TILTSome mouse wheels can be tilted to the left or right. Ranges from -1.0 to +1.0
Network module documentation © Paul Manias © 2005-2026

JTYPE Type

JTYPE flags are used to categorise input types

NameDescription
JTYPE::ANALOGAnalog movement (ranging from -1.0 to 1.0)
JTYPE::ANCHOREDCursor has been anchored with LockCursor()
JTYPE::BUTTONInput is a physical button or switch
JTYPE::CROSSINGCrossing events manage the entering and leaving of an area
JTYPE::DBL_CLICKSet by the input system if the Type is a button and the button has been clicked in quick succession so as to be classed as a double-click
JTYPE::DIGITALD-Pad or digital joystick source (restricted to +/- 1)
JTYPE::DRAGGEDSet if sufficient movement occurred between the original click and its point of release (usually requires a 3 or more pixel difference)
JTYPE::DRAG_ITEMThis special flag is set by the input system if the pointer is click-dragging an object at the time of the event
JTYPE::EXT_MOVEMENTExtended or indirect movement information. This covers all types of movement that are unconnected to coordinate positioning - mouse wheel movement and pen tilt are two such examples
JTYPE::MOVEMENTX/Y coordinate movement only. Movement such as the wheel mouse spinning is not covered by this type as it does not influence the coordinate system
JTYPE::REPEATEDInput is a repeated entry (i.e. user is holding down a button and a repetition timer is being triggered)
JTYPE::SECONDARYIndicates to the receiver of this message that it is not the primary/original recipient
Network module documentation © Paul Manias © 2005-2026

IPAddress Structure

FieldTypeDescription
DataINT128-bit array for supporting both V4 (32-bit host order) and V6 (8-bit byte order) IP addresses.
TypeIPADDRIdentifies the address Data value as a V4 or V6 address type.
PortINTFor UDP packets, identifies the client port number in host byte order.
Network module documentation © Paul Manias © 2005-2026