| Line | |
|---|
| 1 | /*! |
|---|
| 2 | * @file proto_class.h |
|---|
| 3 | * @brief Definition of ... |
|---|
| 4 | */ |
|---|
| 5 | |
|---|
| 6 | #ifndef _UDP_BROADCAST_H |
|---|
| 7 | #define _UDP_BROADCAST_H |
|---|
| 8 | |
|---|
| 9 | #include "netdefs.h" |
|---|
| 10 | #include <cassert> |
|---|
| 11 | |
|---|
| 12 | #define BROADCAST_PACKET_SIZE 1024 |
|---|
| 13 | |
|---|
| 14 | //! A class for sending/recieving brotcast packets for lan |
|---|
| 15 | class UdpBroadcast |
|---|
| 16 | { |
|---|
| 17 | public: |
|---|
| 18 | UdpBroadcast(); |
|---|
| 19 | virtual ~UdpBroadcast(); |
|---|
| 20 | |
|---|
| 21 | bool listen( int port ); |
|---|
| 22 | bool open( int port ); |
|---|
| 23 | int send( byte * data, int length, IPaddress * ip = NULL ); |
|---|
| 24 | int recv( byte * data, int maxLength, IPaddress * ip = NULL ); |
|---|
| 25 | |
|---|
| 26 | private: |
|---|
| 27 | int port; |
|---|
| 28 | UDPpacket * packet; |
|---|
| 29 | UDPsocket socket; |
|---|
| 30 | |
|---|
| 31 | }; |
|---|
| 32 | |
|---|
| 33 | #endif /* _UDP_BROADCAST_H */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.