3rd:SCS - Simple Client Server

From wiki.visual-prolog.com

Revision as of 00:37, 9 January 2008 by Thomas Linder Puls (talk | contribs) (copied from forum)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This package is designed to help you build client and multi-client servers in Visual Prolog CE 7.

SCS (Simple Client Server) uses a native binding to a subset of winsock2 functions and does not use sockbind or mgslayer (at all).

It is designed with multithreading in mind : a server (instance of scsServer class) waits for incoming connections in a thread. A connection is managed by a callback predicate that you provide. An instance of scsClient can then be used to communicate with the client.

The sending of data is a blocking process, but the reception is performed by a listening thread that triggers another callback predicate, passing the data received as argument.

The design is very similar to a standard client/server scheme.

Two different modes are supported :

In the nibble_mode, the reception callback predicate is evaluated as soon as data is available. This doesn't mean you get the data that has been sent : you get pieces of data as soon as it arrives.

In the message_mode (default mode), SCS adds a data management system that only triggers the reception callback when the data reception is complete - this means that you do not have to take care of the rebuilding of complete data : SCS does it for you.

The 'transmitFile' function of winsock2 is supported. This means that you can even send files (see msdn for transmitFile in winsock2).

A tutorial can be found there :

http://www.arsaniit.com/vp_tools/scs.htm

You'll also find the documentation of the classes in a prodoc format (ie the Visual Prolog Help) at the same page.

The demo project shows how to build a time server (that sends the server's time to a client and closes the cnx) and a reverse server (that sends back reversed string until it receives the string 'end').

The demo project features a simple client featuring a console with sending/receving monitoring.

The download link : http://www.arsaniit.com/vp_tools/download/scs_17.zip

3rd-SCS-Simple Client Server.png