DarkSocket object
DarkSocket is a powerful socket extension, capable of creating sockets in several ways.
The basic functionality has a choice of TCP, UDP and ICMP (pinging), which gives a total of 6 methods of using the object (server & client).
Or for advanced users, use different actions, and gain access to over ten thousand possible methods of using the object.
A total of 28 protocols, 29 different address families, and 5 different socket types are supported.
The extension is multithreaded so your program will not halt during any operations – you can have up to 256 sockets open at once, if your hardware is capable enough.

Download includes a HTTP connecting example.

Conditions:
On error:
When an error occurs in the extension.
On new status:
(For debug) When the extension has a new status.
Client returned message: (number Socket ID (use -1 for any socket))
When a client socket has received a message, this condition will trigger. The message can be accessed with LastMessageText$().
On socket done:
When a socket has finished, this condition should trigger.*

Actions:
Client > Basic initialise: (string Hostname, number Port, string Protocol, string Initial text)
The first parameter (Hostname) is the hostname to connect to, the second (Port) is the port to connect on, the third (Protocol) is the protocol to use. The basic mode is limited to “TCP”, “UDP”, and “ICMP”. Once a connection has been established, the text in the fourth parameter (Initial text) is sent to the server.
Client > Advanced initialise: (string Hostname, number Port, string Protocol, string Address family, stringSocket type, string Initial text)
Advanced: Do not use unless you know what you are doing.
The first parameter (Hostname) is the hostname to connect to, the second (Port) is the port to connect on, the third (Protocol) is the protocol to use (IPPROTO_***).
The fourth parameter is the address family (AF_***), and the fifth is the socket type (SOCK_***).
Once a connection has been established, the text in the final parameter (Initial text) is sent to the server.
Some values for the parameters are given here.
Client > Shutdown socket: (number Socket ID)
The parameter (Socket ID) contains the socket ID that is to be shut down.
Client > Go independent: (number Socket ID)
The parameter (Socket ID) contains the socket ID that should go independent. This means it no longer scans for messages from MMF2, and should not be used under normal circumstances.
Client > Set to receive only: (number Socket ID)
The parameter (Socket ID) contains the socket ID that should be set to receive-only. This shuts down the sending part of the socket, generally not used.
Client > Send text to server: (number Socket ID, string Text to send)
The first parameter (Socket ID) contains the socket ID that will send the message, the second (Text to send) contains the text to be sent.
Client > Link socket output to file: (number Socket ID, string File to link to)
The first parameter (Socket ID) contains the socket ID that will send the message, the second (File to link to) contains the file that the message should be appended to. This is useful for keeping a log. To undo, see the next action
Client > Unlink socket output: (number Socket ID)
The first parameter (Socket ID) contains the socket ID that should disable linking. It undos the previous action.
Client > MMF2 reports on/off: (number Socket ID, bool On or off)
The first parameter (Socket ID) contains the socket ID that will have the reports (messages received conditions) disabled or enabled. The second parameter should be 1 or 0, and sets whether the socket reporting is enabled or disabled. If disabled, “Client > On received message” condition will not be ran by the socket. This will report an warning (but not an error) if there is no file linked to the socket, as that means you will have no idea what the socket is doing.

The server actions have not been implemented.

Expressions:
Error$ (bool Clear)
The errors (if any) that have been generated. Use 1 for the parameter (Clear) to erase the current errors. Use with On Error condition.
Report$ (bool Clear)
The reports (if any) that have been generated. Use 1 for the parameter (Clear) to erase the current reports. Use with On Report condition.
LastMessageSocketID
The Socket ID that received a message. Use with Client > On message condition.
LastMessageText$
The last message that was received. Use with Client > On message condition.
LastMessageAddress
The memory address of the last message that was received. Use with Client > On message condition.
LastMessageSize
The size of the last message that was received, in bytes. Use with Client > On message condition.
NewSocketID
The most recently started socket’s ID.
GetSocketIDForLastEvent
The socket ID that ran the “Socket done” condition.

Please note this isn’t the exact format that the final version will take. Any deprecated actions/conditions/expressions will run a popup message requesting you replace them.

Click the title of the object to download.

_________________________
Darkwire Software Head Programmer
Darkwire SoftwareExtension List
Darknet™: Faster than light