Skip to content

Commit

Permalink
Add socket documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsAD committed Jul 15, 2016
1 parent 6193198 commit 538ff0d
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 152 deletions.
25 changes: 13 additions & 12 deletions Doc/sphinx/referencescript.rst
Expand Up @@ -12,23 +12,24 @@ default (Pascal) engine.

.. toctree::

scriptref/web.rst
scriptref/math.rst
scriptref/sound.rst
scriptref/mouse.rst
scriptref/keyboard.rst
scriptref/other.rst
scriptref/tpa.rst
scriptref/string.rst
scriptref/settings.rst
scriptref/color conversion.rst
scriptref/color.rst
scriptref/crypto.rst
scriptref/color conversion.rst
scriptref/bitmap.rst
scriptref/ocr.rst
scriptref/lape.rst
scriptref/dtm.rst
scriptref/sqlite.rst
scriptref/ocr.rst
scriptref/window.rst
scriptref/files.rst
scriptref/web.rst
scriptref/socket.rst
scriptref/sound.rst
scriptref/sqlite.rst
scriptref/settings.rst
scriptref/other.rst
scriptref/tpa.rst
scriptref/string.rst
scriptref/math.rst
scriptref/crypto.rst
scriptref/lape.rst

138 changes: 138 additions & 0 deletions Doc/sphinx/scriptref/socket.rst
@@ -0,0 +1,138 @@
.. _scriptref-socket:

Sockets
=======

With the socket functions you can implement virtually any network procotol:
there have been several IRC bots.

Socket Functions
----------------

Simba's Socket Functions. Examples required; if you have one, please let u know.

CreateSocket
~~~~~~~~~~~~

.. code-block:: pascal
function CreateSocket: integer;
CreateSocket creates a new socket and assigns it an ID.

FreeSocket
~~~~~~~~~~

.. code-block:: pascal
procedure FreeSocket(Index: integer);
FreeSocket frees the socket with the ID (Index) assigned to it upon creation.

ConnectSocket
~~~~~~~~~~~~~

.. code-block:: pascal
procedure ConnectSocket(Client: integer; IP, Port: string);
ConnectSocket connects the socket to an IP and port on the specified client
(Client).


BindSocket
~~~~~~~~~~

.. code-block:: pascal
procedure BindSocket(Client: integer; IP, Port: string);
BindSocket binds a connected socket to an IP and port on the specified client
(Client).

ListenSocket
~~~~~~~~~~~~

.. code-block:: pascal
procedure ListenSocket(Client: integer);
ListenSocket allows for a client socket to accept connections.

AcceptSocket
~~~~~~~~~~~~

.. code-block:: pascal
function AcceptSocket(Client: integer): integer;
AcceptSocket accepts pending connection requests to a client socket.


CloseSocket
~~~~~~~~~~~

.. code-block:: pascal
procedure CloseSocket(Client: integer);
CloseSocket closes connections to a client socket.

RecvSocket
~~~~~~~~~~

.. code-block:: pascal
function RecvSocket(Client: integer): string;
RecvSocket method reads all data waiting for read.

RecvSocketStr
~~~~~~~~~~~~~

.. code-block:: pascal
function RecvSocketStr(Client: integer): string;
Method waits until data string is received. This string is terminated by CR-LF
characters. The resulting string is returned without this termination (CR-LF)

RecvSocketEx
~~~~~~~~~~~~

.. code-block:: pascal
function RecvSocketEx(Client, Length: integer): string;
RecvSocketEx returns received data of a specified length from a bound socket as
a string.


SendSocket
~~~~~~~~~~

.. code-block:: pascal
procedure SendSocket(Client: integer; Data: string);
SendSocket sends a string of data to a bound client socket.

SetTimeout
~~~~~~~~~~

.. code-block:: pascal
procedure SetTimeout(Client, Time: integer);
SetTimeout sets a maximum amount of time for a bound client socket to wait for
data from another socket. Time is in *milliseconds*.

SocketInfo
~~~~~~~~~~

.. code-block:: pascal
procedure SocketInfo(Client: integer; out IP, Port: string);
SocketInfo sets where a bound socket will be sending data to (out IP, out Port).

141 changes: 1 addition & 140 deletions Doc/sphinx/scriptref/web.rst
Expand Up @@ -3,12 +3,7 @@
Internet
========

The internet functions in Simba range from HTTP functions and low-level
socket functions. With the HTTP functions you can scrape the web, send form data
to web pages.

With the socket functions you can implement virtually any network procotol:
there have been several IRC bots.
With HTTP functions you can scrape the web, and send form data to web pages.

HTTP Functions
--------------
Expand Down Expand Up @@ -137,140 +132,6 @@ GetRawHeaders
GetRawHeaders returns a string of headers from the specified client.


Socket Functions
----------------

Simba's Socket Functions. Examples required; if you have one, please let u know.

CreateSocket
~~~~~~~~~~~~

.. code-block:: pascal
function CreateSocket: integer;
CreateSocket creates a new socket and assigns it an ID.

FreeSocket
~~~~~~~~~~

.. code-block:: pascal
procedure FreeSocket(Index: integer);
FreeSocket frees the socket with the ID (Index) assigned to it upon creation.

ConnectSocket
~~~~~~~~~~~~~

.. code-block:: pascal
procedure ConnectSocket(Client: integer; IP, Port: string);
ConnectSocket connects the socket to an IP and port on the specified client
(Client).


BindSocket
~~~~~~~~~~

.. code-block:: pascal
procedure BindSocket(Client: integer; IP, Port: string);
BindSocket binds a connected socket to an IP and port on the specified client
(Client).

ListenSocket
~~~~~~~~~~~~

.. code-block:: pascal
procedure ListenSocket(Client: integer);
ListenSocket allows for a client socket to accept connections.

AcceptSocket
~~~~~~~~~~~~

.. code-block:: pascal
function AcceptSocket(Client: integer): integer;
AcceptSocket accepts pending connection requests to a client socket.


CloseSocket
~~~~~~~~~~~

.. code-block:: pascal
procedure CloseSocket(Client: integer);
CloseSocket closes connections to a client socket.

RecvSocket
~~~~~~~~~~

.. code-block:: pascal
function RecvSocket(Client: integer): string;
RecvSocket method reads all data waiting for read.

RecvSocketStr
~~~~~~~~~~~~~

.. code-block:: pascal
function RecvSocketStr(Client: integer): string;
Method waits until data string is received. This string is terminated by CR-LF
characters. The resulting string is returned without this termination (CR-LF)

RecvSocketEx
~~~~~~~~~~~~

.. code-block:: pascal
function RecvSocketEx(Client, Length: integer): string;
RecvSocketEx returns received data of a specified length from a bound socket as
a string.


SendSocket
~~~~~~~~~~

.. code-block:: pascal
procedure SendSocket(Client: integer; Data: string);
SendSocket sends a string of data to a bound client socket.

SetTimeout
~~~~~~~~~~

.. code-block:: pascal
procedure SetTimeout(Client, Time: integer);
SetTimeout sets a maximum amount of time for a bound client socket to wait for
data from another socket. Time is in *milliseconds*.

SocketInfo
~~~~~~~~~~

.. code-block:: pascal
procedure SocketInfo(Client: integer; out IP, Port: string);
SocketInfo sets where a bound socket will be sending data to (out IP, out Port).

Generic functions
-----------------

SetProxy
~~~~~~~~

Expand Down

0 comments on commit 538ff0d

Please sign in to comment.