diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-01-14 23:14:13 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-01-14 23:14:13 +0000 |
commit | 9edd5b50c2b928be9fc7569170103a41cbc80e5f (patch) | |
tree | 6aca60610546ed3fc9c5d1a6669bb09c2b8c1203 /src/udpsocket.h | |
parent | 8aa6cee7eed01384771e05ecb425e4df9da4687b (diff) | |
download | libbu++-9edd5b50c2b928be9fc7569170103a41cbc80e5f.tar.gz libbu++-9edd5b50c2b928be9fc7569170103a41cbc80e5f.tar.bz2 libbu++-9edd5b50c2b928be9fc7569170103a41cbc80e5f.tar.xz libbu++-9edd5b50c2b928be9fc7569170103a41cbc80e5f.zip |
Here's a udp socket. It's not done yet, it can just about send data.
Diffstat (limited to 'src/udpsocket.h')
-rw-r--r-- | src/udpsocket.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/udpsocket.h b/src/udpsocket.h new file mode 100644 index 0000000..4452458 --- /dev/null +++ b/src/udpsocket.h | |||
@@ -0,0 +1,58 @@ | |||
1 | #ifndef BU_UDP_SOCKET_H | ||
2 | #define BU_UDP_SOCKET_H | ||
3 | |||
4 | #include <stdint.h> | ||
5 | |||
6 | #include "bu/stream.h" | ||
7 | |||
8 | namespace Bu | ||
9 | { | ||
10 | subExceptionDecl( UdpSocketException ); | ||
11 | |||
12 | class UdpSocket : public Stream | ||
13 | { | ||
14 | public: | ||
15 | UdpSocket( int iUdpSocket ); | ||
16 | UdpSocket( const Bu::FString &sAddr, int iPort, bool bBroadcast ); | ||
17 | virtual ~UdpSocket(); | ||
18 | |||
19 | virtual void close(); | ||
20 | virtual size_t read( void *pBuf, size_t nBytes ); | ||
21 | virtual size_t read( void *pBuf, size_t nBytes, | ||
22 | uint32_t nSec, uint32_t nUSec=0 ); | ||
23 | virtual size_t write( const void *pBuf, size_t nBytes ); | ||
24 | virtual size_t write( const void *pBuf, size_t nBytes, | ||
25 | uint32_t nSec, uint32_t nUSec=0 ); | ||
26 | using Stream::write; | ||
27 | |||
28 | virtual long tell(); | ||
29 | virtual void seek( long offset ); | ||
30 | virtual void setPos( long pos ); | ||
31 | virtual void setPosEnd( long pos ); | ||
32 | virtual bool isEos(); | ||
33 | virtual bool isOpen(); | ||
34 | |||
35 | virtual void flush(); | ||
36 | |||
37 | virtual bool canRead(); | ||
38 | virtual bool canWrite(); | ||
39 | |||
40 | virtual bool isReadable(); | ||
41 | virtual bool isWritable(); | ||
42 | virtual bool isSeekable(); | ||
43 | |||
44 | virtual bool isBlocking(); | ||
45 | virtual void setBlocking( bool bBlocking=true ); | ||
46 | |||
47 | virtual void setSize( long iSize ); | ||
48 | |||
49 | private: | ||
50 | #ifdef WIN32 | ||
51 | unsigned int iUdpSocket; | ||
52 | #else | ||
53 | int iUdpSocket; | ||
54 | #endif | ||
55 | }; | ||
56 | }; | ||
57 | |||
58 | #endif | ||