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.
AddressToStr | HostToLong | HostToShort | LongToHost | SetSSL | ShortToHost | StrToAddress
ClientSocket | NetClient | NetLookup | NetServer | NetSocket | Proxy
Converts an IPAddress structure to an IPAddress in dotted string form.
| Parameter | Description |
|---|---|
| IPAddress | A pointer to the IPAddress structure. |
| Result | Must 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.
| Okay | The IPAddress was converted successfully. |
|---|
Converts a 32 bit (unsigned) long from host to network byte order.
| Parameter | Description |
|---|---|
| Value | Data in host byte order to be converted to network byte order |
Converts a 32 bit (unsigned) long from host to network byte order.
The long in network byte order
Converts a 16 bit (unsigned) word from host to network byte order.
| Parameter | Description |
|---|---|
| Value | Data in host byte order to be converted to network byte order |
Converts a 16 bit (unsigned) word from host to network byte order.
The word in network byte order
Converts a 32 bit (unsigned) long from network to host byte order.
| Parameter | Description |
|---|---|
| Value | Data in network byte order to be converted to host byte order |
Converts a 32 bit (unsigned) long from network to host byte order.
The Value in host byte order.
Alters SSL settings on an initialised NetSocket client object.
| Parameter | Description |
|---|---|
| NetSocket | The target NetSocket object. |
| Command | Name of a command or option to set (case-sensitive, camel-case). |
| Value | Value 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:
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.
| Okay | Operation successful. |
|---|---|
| Retry | SSL handshaking needs to be retried. |
| Failed | SSL setup or connection setup failed. |
| FieldNotSet | SSL state was not initialised for the socket. |
| SystemCall | The SSL library or platform SSL backend reported a system-level failure. |
| Disconnected | SSL reported that the peer disconnected during handshaking. |
| NullArgs | The NetSocket argument was not specified. |
| WrongClass | The object is not a NetSocket. |
| WouldBlock | SSL handshaking would block. |
| InputOutput | SSL handshaking failed due to an I/O error. |
| NoSecureSockets | SSL support is disabled in this build. |
Converts a 16 bit (unsigned) word from network to host byte order.
| Parameter | Description |
|---|---|
| Value | Data in network byte order to be converted to host byte order |
Converts a 16 bit (unsigned) word from network to host byte order.
The Value in host byte order
Converts an IP Address in string form to an IPAddress structure.
| Parameter | Description |
|---|---|
| String | A null-terminated string containing the IP Address in dotted format. |
| Address | Must 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)) {
...
}
| Okay | The Address was converted successfully. |
|---|---|
| Syntax | The String was not a valid IP Address. |
| NullArgs | Function call missing argument value(s) |
Address types for the IPAddress structure.
| Name | Description |
|---|---|
| IPADDR::V4 | |
| IPADDR::V6 |
JET constants are documented in GetInputEvent()
| Name | Description |
|---|---|
| JET::ABS_XY | The X, Y values are defined as absolute coordinates, relative to the top-left of the display |
| JET::BUTTON_1 | Left 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_10 | Non-specific button assignment |
| JET::BUTTON_2 | Right mouse button; XBox X button, PS cross button |
| JET::BUTTON_3 | Middle mouse button; XBox Y button, PS triangle |
| JET::BUTTON_4 | Alt. mouse button 1; XBox B button, PS circle |
| JET::BUTTON_5 | Alt. mouse button 2 |
| JET::BUTTON_6 | Non-specific button assignment |
| JET::BUTTON_7 | Non-specific button assignment |
| JET::BUTTON_8 | Non-specific button assignment |
| JET::BUTTON_9 | Non-specific button assignment |
| JET::CROSSED_IN | This 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_OUT | This 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_XY | Controller tilted on the X/Y axis. Value indicates angle, -ve = left, +ve = right |
| JET::DEVICE_TILT_Z | Controller is rising or falling. Value expressed as 'speed', |
| JET::DISPLAY_EDGE | Recently supplied input occurred at the edge of the display |
| JET::PEN_TILT_XY | Pen tilt angle. 0 is pointing down directly with nib at bottom, 0.5 is 90 degrees, 1.0 is inversed (eraser at bottom) |
| JET::PRESSURE | Amount of pressure applied, ranges from 0 (none) to 1.0 (normal) and possibly higher if user presses hard enough |
| JET::WHEEL | Mouse wheel rotation - the value generally reflects the number of 'clicks' rotated on the wheel |
| JET::WHEEL_TILT | Some mouse wheels can be tilted to the left or right. Ranges from -1.0 to +1.0 |
JTYPE flags are used to categorise input types
| Name | Description |
|---|---|
| JTYPE::ANALOG | Analog movement (ranging from -1.0 to 1.0) |
| JTYPE::ANCHORED | Cursor has been anchored with LockCursor() |
| JTYPE::BUTTON | Input is a physical button or switch |
| JTYPE::CROSSING | Crossing events manage the entering and leaving of an area |
| JTYPE::DBL_CLICK | Set 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::DIGITAL | D-Pad or digital joystick source (restricted to +/- 1) |
| JTYPE::DRAGGED | Set if sufficient movement occurred between the original click and its point of release (usually requires a 3 or more pixel difference) |
| JTYPE::DRAG_ITEM | This special flag is set by the input system if the pointer is click-dragging an object at the time of the event |
| JTYPE::EXT_MOVEMENT | Extended 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::MOVEMENT | X/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::REPEATED | Input is a repeated entry (i.e. user is holding down a button and a repetition timer is being triggered) |
| JTYPE::SECONDARY | Indicates to the receiver of this message that it is not the primary/original recipient |
| Field | Type | Description |
|---|---|---|
| Data | INT | 128-bit array for supporting both V4 (32-bit host order) and V6 (8-bit byte order) IP addresses. |
| Type | IPADDR | Identifies the address Data value as a V4 or V6 address type. |
| Port | INT | For UDP packets, identifies the client port number in host byte order. |