VILLASframework
Modular co-simulation framework
Sockets

The socket node-type is the most comprehensive and complex one. It allows to send and receive simulation data over the network. Internally it uses the well known BSD socket API.

Please note that only datagram / packet, connection-less based network protocols are supported. This means that there's currently no support for TCP!

The implementation supports multiple protocols / OSI layers:

  • Layer 1: Raw Ethernet Frames (no routing!)
  • Layer 2: Raw IP (internet / VPN routing possible)
  • Layer 3: UDP encapsulation

Prerequisites

This node-type does not have any special library dependencies. It is always available.

Optionally, libnl3 is used to setup network emulation as described in section node-type-socket-netem.

Implementation

The source code of the node-type is available here: https://git.rwth-aachen.de/acs/public/villas/node/blob/master/lib/nodes/socket.cpp

Configuration

Every socket node supports the following special settings:

format (string: "csv" | "json" | "villas.human" | "raw" | ...)

The payload format which is used to encode and decode exchanged messages.

See: Format-types

in.address (string: "ip:port" | "mac:protocol")

The local address and port number this node should listen for incoming packets.

Use * to listen on all interfaces: local = "*:12000".

out.address (string: "ip:port" | "mac:protocol")

The remote address and port number to which this node will send data.

layer (string: "udp" | "ip" | "eth") = "udp"

Select the network layer which should be used for the socket. Please note that eth can only be used locally in a LAN as it contains no routing information for the internet.

verify_source (boolean) = false

Check if source address of incoming packets matches the remote address.

out.netem (dictionary)

Enables and configures the network emulation qeueing discipline.

For information see also: Network Emulation

in.multicast (dictionary)

The Sockets support sending and receiving IP / UDP packets to and from multicast addresses.

Note: Multicast is only supported by IPv4 addressing. Using these settings with layer = eth or IPv6 adresses will fail!

in.multicast.enabled (boolean) = true

Weather or not multicast group subscription is active.

in.multicast.group (string: IPv4 Address)

The multicast group. Must be within 224.0.0.0/4

in.multicast.interface (string: IPv4 Address)

The IP address of the interface which should receive multicast packets.

in.multicast.ttl (integer)

The time to live for outgoing multicast packets.

in.multicast.loop (boolean)

Example