Socket Connection

Aus ExpeccoWiki

Wechseln zu: Navigation, Suche

Description

The following example creates a server that receives a connection request from a client. After the connection is established, the server writes some data to the socket and the client reads the data from the socket.
The steps are executed in parallel ( Immediately fork new ActivityProcess). This ensures, that the client is not suspended while the server waits for incoming connections in the accept.

You will find the socket blocks in the Standard Library under the folder Socket Streams.
Socket Connection Example 1.JPG

For demonstration purposes, the server and client are running under the same activity diagram. The upper part of the diagram implements the server activities, the lower part the client activities. In the real world you will either need the server OR the client part.

The following actions setup socket connections and read/write textual (ascii) data.

Socket Connection Example 2.JPG

The next example demonstrates how to read and write raw binary data.

Socket Connection Example 3.JPG

Download

Here is the testsuite to be loaded into expecco: Example_Socket_Connect.ets

Back to Examples.

Meine Werkzeuge