Agilent Technologies E4406A VSA Satellite Radio User Manual


 
150 Chapter 3
Programming Examples
Using C Programming Over Socket LAN
*/
/* Support both Win32 and HP-UX UNIX environment */
#ifdef _WIN32 /* Visual C++ 4.0 will define this */
# define WINSOCK
#endif
#ifndef WINSOCK
# ifndef _HPUX_SOURCE
# define _HPUX_SOURCE
# endif
#endif
#include <stdio.h> /* for fprintf and NULL */
#include <string.h> /* for memcpy and memset */
#include <stdlib.h> /* for malloc(), atol() */
#include <errno.h> /* for strerror */
#ifdef WINSOCK
#include <windows.h>
# ifndef _WINSOCKAPI_
# include <winsock.h> // BSD-style socket functions
# endif
#else /* UNIX with BSD sockets */
# include <sys/socket.h> /* for connect and socket*/
# include <netinet/in.h> /* for sockaddr_in */
# include <netdb.h> /* for gethostbyname */
# define SOCKET_ERROR (-1)
# define INVALID_SOCKET (-1)
typedef int SOCKET;