diff options
Diffstat (limited to 'src/unstable/udpsocket.h')
-rw-r--r-- | src/unstable/udpsocket.h | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/src/unstable/udpsocket.h b/src/unstable/udpsocket.h index 8f8630a..569a6fb 100644 --- a/src/unstable/udpsocket.h +++ b/src/unstable/udpsocket.h | |||
@@ -15,68 +15,68 @@ | |||
15 | 15 | ||
16 | namespace Bu | 16 | namespace Bu |
17 | { | 17 | { |
18 | subExceptionDecl( UdpSocketException ); | 18 | subExceptionDecl( UdpSocketException ); |
19 | 19 | ||
20 | class UdpSocket : public Stream | 20 | class UdpSocket : public Stream |
21 | { | 21 | { |
22 | public: | 22 | public: |
23 | UdpSocket( int iUdpSocket ); | 23 | UdpSocket( int iUdpSocket ); |
24 | UdpSocket( const Bu::String &sAddr, int iPort, int iFlags ); | 24 | UdpSocket( const Bu::String &sAddr, int iPort, int iFlags ); |
25 | virtual ~UdpSocket(); | 25 | virtual ~UdpSocket(); |
26 | 26 | ||
27 | typedef uint32_t addr; | 27 | typedef uint32_t addr; |
28 | 28 | ||
29 | static Bu::String addrToStr( const addr &a ); | 29 | static Bu::String addrToStr( const addr &a ); |
30 | 30 | ||
31 | virtual void close(); | 31 | virtual void close(); |
32 | virtual Bu::size read( void *pBuf, Bu::size nBytes ); | 32 | virtual Bu::size read( void *pBuf, Bu::size nBytes ); |
33 | virtual Bu::size read( void *pBuf, Bu::size nBytes, | 33 | virtual Bu::size read( void *pBuf, Bu::size nBytes, |
34 | addr &sHost, int &iPort ); | 34 | addr &sHost, int &iPort ); |
35 | virtual Bu::size write( const void *pBuf, Bu::size nBytes ); | 35 | virtual Bu::size write( const void *pBuf, Bu::size nBytes ); |
36 | using Stream::write; | 36 | using Stream::write; |
37 | 37 | ||
38 | virtual Bu::size tell(); | 38 | virtual Bu::size tell(); |
39 | virtual void seek( Bu::size offset ); | 39 | virtual void seek( Bu::size offset ); |
40 | virtual void setPos( Bu::size pos ); | 40 | virtual void setPos( Bu::size pos ); |
41 | virtual void setPosEnd( Bu::size pos ); | 41 | virtual void setPosEnd( Bu::size pos ); |
42 | virtual bool isEos(); | 42 | virtual bool isEos(); |
43 | virtual bool isOpen(); | 43 | virtual bool isOpen(); |
44 | 44 | ||
45 | virtual void flush(); | 45 | virtual void flush(); |
46 | 46 | ||
47 | virtual bool canRead(); | 47 | virtual bool canRead(); |
48 | virtual bool canWrite(); | 48 | virtual bool canWrite(); |
49 | 49 | ||
50 | virtual bool isReadable(); | 50 | virtual bool isReadable(); |
51 | virtual bool isWritable(); | 51 | virtual bool isWritable(); |
52 | virtual bool isSeekable(); | 52 | virtual bool isSeekable(); |
53 | 53 | ||
54 | virtual bool isBlocking(); | 54 | virtual bool isBlocking(); |
55 | virtual void setBlocking( bool bBlocking=true ); | 55 | virtual void setBlocking( bool bBlocking=true ); |
56 | 56 | ||
57 | virtual void setSize( Bu::size iSize ); | 57 | virtual void setSize( Bu::size iSize ); |
58 | 58 | ||
59 | enum { | 59 | enum { |
60 | // Flags | 60 | // Flags |
61 | Read = 0x01, ///< Open udp socket for reading | 61 | Read = 0x01, ///< Open udp socket for reading |
62 | Write = 0x02, ///< Open udp socket for writing | 62 | Write = 0x02, ///< Open udp socket for writing |
63 | ReadWrite = 0x03, ///< Open for both read and write | 63 | ReadWrite = 0x03, ///< Open for both read and write |
64 | Broadcast = 0x04, ///< Open for broadcast | 64 | Broadcast = 0x04, ///< Open for broadcast |
65 | }; | 65 | }; |
66 | 66 | ||
67 | virtual size getSize() const; | 67 | virtual size getSize() const; |
68 | virtual size getBlockSize() const; | 68 | virtual size getBlockSize() const; |
69 | virtual Bu::String getLocation() const; | 69 | virtual Bu::String getLocation() const; |
70 | 70 | ||
71 | private: | 71 | private: |
72 | #ifdef WIN32 | 72 | #ifdef WIN32 |
73 | unsigned int iUdpSocket; | 73 | unsigned int iUdpSocket; |
74 | #else | 74 | #else |
75 | int iUdpSocket; | 75 | int iUdpSocket; |
76 | #endif | 76 | #endif |
77 | void *paTarget; | 77 | void *paTarget; |
78 | bool bBound; | 78 | bool bBound; |
79 | }; | 79 | }; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | #endif | 82 | #endif |