Owner's manual

Sample Communication Application
Beijer Electronics, MAEN975 125
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 Beijer Electronics Nautic Monitor. It has been
successfully compiled and tested under Linux and Windows. The source code con-
tains all basic routines necessary to create valid SCOM messages and send it via Eth-
ernet 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 */