Moxa IA3341-LX [17/72] Developing your first application

Moxa IA3341-LX [17/72] Developing your first application
IA3341 Linux User’s Manual Getting Started
2-9
Developing Your First Application
We use the tcps2 example to illustrate how to build an application. The procedure outlined in the
following subsections will show you how to build a TCP server program plus serial port
communication that runs on the IA3341.
Testing Environment
The tcps2 example demonstrates a simple application program that delivers transparent,
bi-directional data transmission between the IA3341’s serial and Ethernet ports. As illustrated in
the following figure, the purpose of this application is to transfer data between PC 1 and the
IA3341 through an RS-232 connection. At the remote site, data can be transferred between the
IA3341’s Ethernet port and PC 2 over an Ethernet connection.
IA3341
RS-232 LAN
PC1
PC2
Compiling tcps2.c
The source code for the tcps2 example is located on the CD-ROM at
CD-ROM://example/TCPServer2/tcps2.c. Use the following commands to copy the file to a
specific directory on your PC. We use the direrctory /home/ ia3341/1st_application/. Note that
you need to copy 3 filesMakefile, tcps2.c, tcpsp.cfrom the CD-ROM to the target directory.
#mount –t iso9660 /dev/cdrom /mnt/cdrom
#cp /mnt/cdrom/example/TCPServer2/tcps2.c /home/IA3341/1st_application/tcps2.c
#cp /mnt/cdrom/example/TCPServer2/tcpsp.c /home/ IA3341/1st_application/tcpsp.c
#cp /mnt/cdrom/example/TCPServer2/Makefile /home/ IA3341/1st_application/Makefile
Type #make to compile the example code:
You will get the following response, indicating that the example program was compiled
successfully.

Содержание

Похожие устройства

Скачать