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

Revision 3230, 0.9 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 __RECEIVER_H
2#define __RECEIVER_H
3
4
5////////////////////////////////////////////////////////////
6// Receiver.h
7//
8// Class definition for the recipient of a broadcasted message
9//
10
11#if !defined(WIN32) || defined(__CYGWIN__)
12    #include <netinet/in.h>
13#endif
14
15class Receiver
16{
17    public :
18
19        Receiver();
20        ~Receiver();
21
22        // setBuffer defines the buffer into which the broadcasted
23        // message will be received.
24        void setBuffer( void *buffer, const unsigned int size );
25
26        // Define what port to listen and bind to
27        void setPort( const short port );
28
29        // Sync does a blocking wait to recieve next message
30        void sync( void );
31
32    private :
33        bool init( void );
34
35    private :
36#if defined (WIN32) && !defined(__CYGWIN__)
37        SOCKET _so;
38        SOCKADDR_IN saddr;
39#else
40        int _so;
41        struct sockaddr_in saddr;
42#endif
43    bool _initialized;
44    short _port;
45    void *_buffer;
46    unsigned int _buffer_size;
47};
48#endif 
Note: See TracBrowser for help on using the browser.