This example demonstrates how to establish a connection between programs running in KasperskyOS via TCP sockets using a loopback interface.
Example directory in the SDK
The code of the example and build scripts are available at the following path:
/opt/KasperskyOS-Community-Edition-<platform>-<version>/examples/net_with_separate_vfs
List of programs
Client – application that creates a TCP socket, connects to the server through the loopback interface, sends data to the server, and closes the connection.Server – application that accepts the connection request through the TCP socket, receives data from the client, and then closes the connection.VfsNet – system program that supports network protocols.DCM – system program that lets you dynamically create IPC channels.EntropyEntity – system program that implements random number generation.DNetSrv – network card driver.When you build an example for the target hardware platform, platform-specific drivers are automatically included in the solution:
BSP – Board Support Package that provides cross-platform peripheral configuration for the Radxa ROCK 3A.Bcm2711MboxArmToVc – driver for working with the VideoCore (VC6) coprocessor via mailbox technology for Raspberry Pi 4 B.Initialization description
The solution initialization description file named init.yaml is generated during the solution build process based on the ./einit/src/init.yaml.in template. Macros in @INIT_*@ format contained in the template are automatically expanded in the resulting init.yaml file. For more details, refer to init.yaml.in template.
Security policy description
The security.psl file contains a description of a security policy for a KasperskyOS-based solution and is located in the ./einit/src directory. The declarations in the PSL file are provided with comments that explain the purpose of these declarations.
Resources
The ./resources/xdl/net_with_separate_vfs directory contains the Client.edl and Server.edl files, which are the EDL descriptions of the Client and Server programs, respectively.
The ./resources/romfs/etc directory contains the hosts configuration file for the VfsNet program.
Operating scenario
The Client and Server programs establish a TCP connection through the loopback interface. To do so, they use one instance of the network stack. In other words, they interact with a "shared" VFS program (in the example, this is the VfsNet program). Both programs use standard POSIX functions in their code. The Server program waits for incoming data using the recv() function, and the Client program sends data over an established TCP connection using the send() function.
Building and running the example
The CMake system, which is included with KasperskyOS Community Edition, is used to build and run the example.
See Building and running examples section.
Page top