Writing a tcp program, 1 running the sample program, 1 tcptest in microsoft visual basic 6 – Atop Technology SE5001 Series User Manual

Page 65

Advertising
background image

User Manual Version 1.6

SE5001 Serial Device Server

Copyright © 2011 Atop Technologies, Inc.

All rights reserved. Designed in Taiwan.

64

5. Writing a TCP Program

Before working on the sample TCP program, please make sure the serial device server is properly configured to
the TCP server mode. The sample program is a TCP Client that connects to the serial device server.

5.1 Running the Sample Program

Sample programs written in Microsoft Visual Basic 6 and Visual C++ 6 are included in the CD with their source
codes. Find them inside \sample\vb_ap\ and \sample\vc_ap respectively.

5.1.1 TCPTEST in Microsoft Visual Basic 6

This sample program is written in Visual Basic 6.0 with Winsock Controls. It demonstrates how to send and receive
data from a PC to SE5001 via Ethernet using two TCP sockets.

Open the project file by double clicking tcptest.vbp or open it in Visual Basic (Figure 5.1). Press the Start button to
launch TCPtest in debug mode.

Figure 5.1 TCP Test Sample Program in Visual Basic

It is also possible to launch the precompiled program (Figure 5.2) without installing Visual Basic, double click on
Tcptest.exe to launch. Make sure Visual Basic 6 Runtime is installed.

Service Pack 6 for Visual Basic 6.0: Run-Time Redistribution Pack from Microsoft:

http://www.microsoft.com/download/en/details.aspx?id=24417

The sample program first connects to the serial device server located at 10.0.187.185 with port 4660 and send
Hello World! Note that the serial interface of the serial device server is in a loopback configuration (Rx and Tx are

Advertising