Using TCP Ports¶
This provides the simplest way to interface to a system that is not on the same machine. Each of the external interface is mapped to a TCP port and can be read from or written to.
For the purpose of demonstration in this walkthrough, we will use a simple function included in vsi_examples repository. Using git, clone the vsi_examples repository:
Create a new project and work through the wizard to the end. Select any part/board as it won’t matter since we’re only going to be using the software for the walkthrough.
menu->flow->Create Platform. Accept the prefilled default options and Press okay.
menu->flow->Create Context. Change the dropdown to
Softwareand enter name as
tcp_walkthrough. Press okay.
Open Context block properties by double clicking inside
tcp_walkthroughand scroll down to
Software Parameters->map exposed interfaces as. Make sure that
TCP Portsis selected.
Press okay to close the properties dialog.
Then create a system canvas by selecting
flow->create system. Accept the prefilled defaults.
Open the newly created system canvas and select
Double click the
tcp_walkthroughcontext to enter hierarchy.
Add a new
VSI Software Wizardblock by right clicking and selecting
VSI Software Wizard.
Open newly added block properties by double-clicking it.
Click browse beside
Source Directoryand browse to select source code directory
C/C++ Functiondropdown box should be populated with multiple entries. Open and select
Arg 1in Arguments section.
Change the direction of
Arg 2in Arguments section to
output. Press okay to close properties.
Right click each interface and select
flow->Build Software Contextsand then Select
Wait for the build to successfully complete.
Browse to the directory
<project_dir>/vsi_auto_gen/sw/system_1in a terminal.
Run the system by using the following command
Use a tcp client to connect to the input interface marked external. For this walkthrough, we’ll use
netcatas a TCP client. Enter the following command to run
netcat localhost 1999.
Open another terminal and enter
netcat localhost 2000. This will connect to the output where you will see the processed data being emitted.
Enter a blob of data < 256 Bytes and press enter.
You should see the processed data in the second terminal.