While RIOTOUS can operate with most servers it is mainly designed to operate with a RIOTOUS server. The server side code handles data transfers, client connections, timeouts, and port assigning while keeping every connected client in its own thread. Only a few functions are needed to be called by the user to start the server and once started, only a few functions are needed to send and receive data to and from clients. Since the RIOTOUS server code is a VB.net class, you can use any project type including forms, command line, and even an XNA project if desired.

Server Class

The first task in creating a RIOTOUS server is creating an instance of the server class. Two files require to be imported into you project; Server.vb and client.vb. Server.vb contains the server class itself while client.vb contains the client class which is called by the server. Below is the code needed to create an instance of the RIOTOUS server.

Dim RIOTOUS As riotous_Server
RIOTOUS = New riotous_Server

With the server instance created, the server needs to be started. This is done by calling the function startServer and passing two arguments; the IP address of the machine executing the server, and the port that the server will advertise on.

RIOTOUS.startServer("192.168.0.1", "333")

While you may choose any port to advertise the server on it is best to use 333 as its a commonly unused port. Once the server starts, it will await for device connections and once a device connects, the server will find a free port slot (starting from 60000 upward), tell the client which port to reconnect to, and then close the connection.