User's Manual

724-746-5500 | blackbox.com
Page 44
LES301A user manual
724-746-5500 | blackbox.com
Chapter 7: Start Writing Your Own Applications
7. Start Writing Your Own Applications
Before you start writing host applications or programs to interact with LES301A, make sure you have done the following.
7.1 Preparing the System
1. Properly connect the LES301A hardware, including power, Ethernet, and serial cable.
2. Properly configure the LES301A parameters, including connection type, IP address, gateway IP address, and network mask (see
Chapter 3).
3. Configure the LES301A as a TCP Server using the default TCP port number “4660.
4. The host (PC) application program must be configured as a TCP client and connects to the LES301A with a designated TCP port
number “4660for COM1.
5. Make sure the LES301A is running by checking the running status through the SerialManager configuration utility.
7.2 Running the Sample Program
Sample programs written in VB and VC++ are included in the package for reference; source codes are also included. You can find
test programs on the product CD or diskette under the directory of \sample\vb_ap\and \sample\vc_ap, respectively.
There are two test programs: TCPTEST written in Visual Basic and TCPTEST2 written in Visual C++.
7.2.1 TCPTEST in Visual Basic
This sample program is written in Visual Basic 5.0 with Winsock Controls. It shows how to send and receive data between host
(PC) and LES301A via Ethernet in two socket ports.
Run Visual Basic and open sample program tcptest.vbp. After the program is started successfully, you can start testing functions.
For more information, press “Helpin the program for a detailed explanation.
NOTE: Make sure the Microsoft visual studio family software is installed on the computer. Otherwise, the sample program will not
run.
Figure 7-1. TCP test sample program in Visual Basic.