CIGI API Version 2.7.1 
CIGI API : Users' Guide
Examples : Simple Host and IG

Examples

Simple Host and Image Generator Examples

The example illustrates the code used to implement a CIGI compliant host and CIGI compliant IG, in their simplest form. Each of the sample applications do little more than establish a network connection, pass CIGI packets back and forth, and print them out. The values of the fields in each packet are incremented by 1 each time they are sent.

Furthermore, these sample applications illustrate the usage of the CIGI iteration functions and of user-definable packets. The examples are intended to be platform independent.

Before building the application, make sure to change the constants defined at the top of the CigiHostMain.cpp and CigiImageGeneratorMain files, including the RECEIVE_PORT, SEND_PORT, and REMOTE_ADDRESS variables. The RECEIVE_PORT and SEND_PORT values can be left alone, unless they refer to ports that are already in use, or are blocked by a local firewall. The SEND_PORT for the CigiHost application should be set to the RECEIVE_PORT of the CigiImageGenerator, and vice versa.

The REMOTE_ADDRESS variable for the CigiHost should be changed to the IP where the CigiImageGenerator application will be running, and vice versa. Both applications can be running on the same IP address.

To build the CigiHost example, the files from the following directories in the file listing section (see below) will be needed:

  • cigi/samples/CigiHost
  • cigi/samples/common
  • cigi/api
  • cigi/sdk

To build the CigiImageGenerator example, the files from the following directories in the file listing section (see below) will be needed:

  • cigi/samples/CigiImageGenerator
  • cigi/samples/common
  • cigi/api
  • cigi/sdk

For Visual C++ 6.0 users under the Windows platform, the following project files can be used to build the examples.

cigi
CIGI home folder.
samples
CIGI sample applications.
CigiHost
Command-line sample of a host implementation.
CigiHost.dep
Visual C++ 6.0 dependency file (Win32).
CigiHost.dsp
Visual C++ 6.0 project file (Win32).
CigiHost.dsw
Visual C++ 6.0 workspace file (Win32).
CigiHost.mak
Visual C++ 6.0 make file (Win32).
CigiImageGenerator
Command-line sample of an IG implementation.
CigiImageGenerator.dep
Visual C++ 6.0 dependency file (Win32).
CigiImageGenerator.dsp
Visual C++ 6.0 project file (Win32).
CigiImageGenerator.dsw
Visual C++ 6.0 workspace file (Win32).
CigiImageGenerator.mak
Visual C++ 6.0 make file (Win32).

For those running under the IRIX platform on SGI using a MIPS Pro compiler, the following scripts can be used to build the examples.

cigi
build
CIGI build files.
Irix
Build files for Irix (SGI).
mipspro
Build files for the MIPS Pro compiler.
CigiHost
Build files for the CigiHost sample.
BuildCigiHost
Example CigiHost build script.
CigiImageGenerator
Build files for the CigiImageGenerator sample.
BuildCigiImageGenerator
Example CigiImageGenerator build script.

Note: Before building the examples on SGI / IRIX, please refer to the section on known compiler issues regarding the MIPS Pro compiler on this platform.

To run the test, first build both samples and start the CigiHost application first. Then, start the CigiImageGenerator application, and output should be sent from each application to the console. To end the programs, use CTRL+C to terminate them.

The following listing shows the source files needed for the CigiHost and CigiImageGenerator examples. The files under the cigi/samples/CigiHost directory are only needed to build the CigiHost example, and the files under the cigi/samples/CigiImageGenerator directory are only needed to build the CigiImageGenerator example.

cigi
CIGI home folder.
api
CIGI API source files.
cigi_api.h
Core API header.
cigi_api.c
Core API implementation.
cigi_compatibility.h
Backwards compatibility header.
cigi_helper.h
CIGI API utility header.
cigi_helper.c
CIGI API utility implementation.
cigi_icd.h
The CIGI interface header.
cigi_version.h
Version control header.
sdk
CIGI SDK source files.
SocketConnection.h
Socket connection class.
SocketConnection.cpp
StatusInfo.h
Status information class.
StatusInfo.cpp
UdpInetSocket.h
UDP connection class.
UdpInetSocket.cpp
samples
CIGI sample applications.
CigiHost
Command-line sample of a host implementation.
CigiHostMain.cpp
Platform-independent source file.
CigiImageGenerator
Command-line sample of an IG implementation.
CigiImageGeneratorMain.cpp
Platform-independent source file.
common
Common sample files.
cigi_test.h
Header file for CIGI test routines.
cigi_test.c
Implementation of CIGI test routines.
cigi_user.h
Header file for a user-definable packet.
cigi_user.c
Implementation of a user-definable packet.
SourceForge LogoBoeing
******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ********