7 sample communication application, Sample communication application, 7sample communication application – Beijer Electronics SCOM Protocol EN User Manual

Page 137

Advertising
background image

Sample Communication Application

Elektronik-Systeme Lauer, MAEN976

137

7

Sample Communication
Application

This chapter provides the full source code of a simple command line application,
which can be used to remote control a Lauer Navigation Monitor. It has been suc-
cessfully compiled and tested under Linux and Windows. The source code contains
all basic routines necessary to create valid SCOM messages and send it via Ethernet
using UDP with broadcast addressing.

/*** lscom *****************************************************/

/*

*/

/* Elektronik-Systeme LAUER GmbH & Co. KG ++++

*/

/* http://www.lauer-hmi.com

*/

/***************************************************************/

/*

*/

/* Title : Lauer SCOM Sample Communication Application

*/

/*

*/

/* Project : Lauer Navigation Monitor

*/

/*

*/

/* Start : 14.01.2009

*/

/*

*/

/* Version : 1.0 - 29.01.2009

*/

/* - First public release.

*/

/*

*/

/* Developer : Can Cetkin (cc)

*/

/*

*/

/* Platform : All

*/

/*

*/

/* Language : ANSI C

*/

/*

*/

/* Description:

*/

/*

This simple command line application allows sending and

*/

/*

receiving SCOM messages via Ethernet using UDP at ports

*/

/*

10000/10001. The source code can be compiled on any plat-*/

/*

form with ANSI C and network socket support. It has been */

/*

successfully compiled and tested on Linux and Windows.

*/

/*

*/

/***************************************************************/

/* © Elektronik-Systeme LAUER GmbH & Co. KG

*/

/***************************************************************/

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#ifdef _WIN32

#include <Winsock2.h>

#define close closesocket

#else

#include <sys/types.h>

#include <sys/socket.h>

#include <netinet/in.h>

#include <unistd.h>

#endif /* _WIN32 */

Advertising