104 Chapter 2
Programming Fundamentals
Using the LAN to Control the Analyzer
Using a Java™ Applet Over Socket LAN
The example program “Using Java Programming Over Socket LAN” on
page 171 demonstrates simple socket programming with Java. It is
written in Java programming language, and will compile with Java
compilers versions 1.0 and above.
This program is on your documentation CD ROM that shipped with the
product.
Using a C Program Over Socket LAN
The example programs “Using C Programming Over Socket LAN” on
page 148 and “Using C Programming Over Socket LAN (Windows NT)”
on page 168 demonstrate simple socket programming. They are written
in C, and compile in the HP-UX UNIX environment or the WIN32
environment.
In UNIX, LAN communication via sockets is very similar to reading or
writing a file. The only difference is the openSocket() routine, which
uses a few network library routines to create the TCP/IP network
connection. Once this connection is created, the standard fread() and
fwrite() routines are used for network communication.
In Windows, the routines send() and recv() must be used, since
fread() and fwrite() may not work on sockets.