root/OpenSceneGraph/trunk/examples/osgcluster/broadcaster.h @ 3230

Revision 3230, 1.1 kB (checked in by robert, 10 years ago)

From Norman Vine (with small tweaks by Robert Osfield), build fixes for Cygwin

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1#ifndef __BROADCASTER_H
2#define __BROADCASTER_H
3
4////////////////////////////////////////////////////////////
5// Broadcaster.h
6//
7// Class definition for broadcasting a buffer to a LAN
8//
9
10#if !defined(WIN32) || defined(__CYGWIN__)
11    #include <netinet/in.h>
12#endif
13
14class Broadcaster 
15{
16    public :
17
18        Broadcaster( void );
19        ~Broadcaster( void );
20
21        // Set the broadcast port
22        void setPort( const short port );
23
24        // Set the buffer to be broadcast
25        void setBuffer( void *buffer, const unsigned int buffer_size );
26
27        // Set a recipient host.  If this is used, the Broadcaster
28        // no longer broadcasts, but rather directs UDP packets at
29        // host.
30        void setHost( const char *hostname );
31
32        // Sync broadcasts the buffer
33        void sync( void );
34
35    private :
36        bool init( void );
37
38    private :
39#if defined(WIN32) && !defined(__CYGWIN__)
40        SOCKET _so;
41#else
42        int _so;
43#endif
44        bool _initialized;
45        short _port;
46        void *_buffer;
47        unsigned int _buffer_size;
48#if defined(WIN32) && !defined(__CYGWIN__)
49        SOCKADDR_IN saddr;
50#else
51        struct sockaddr_in saddr;
52#endif
53        unsigned long _address;
54};
55#endif
Note: See TracBrowser for help on using the browser.