aboutsummaryrefslogtreecommitdiff
path: root/src/socket.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket.h')
-rw-r--r--src/socket.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/socket.h b/src/socket.h
new file mode 100644
index 0000000..c291549
--- /dev/null
+++ b/src/socket.h
@@ -0,0 +1,55 @@
1#ifndef BU_SOCKET_H
2#define BU_SOCKET_H
3
4#include <stdint.h>
5
6#include "stream.h"
7#include "fstring.h"
8
9namespace Bu
10{
11 /**
12 *
13 */
14 class Socket : public Stream
15 {
16 public:
17 Socket( int nSocket );
18 Socket( const FString &sAddr, int nPort, int nTimeout=30 );
19 virtual ~Socket();
20
21 virtual void close();
22 //virtual void read();
23 virtual size_t read( void *pBuf, size_t nBytes );
24 virtual size_t read( void *pBuf, size_t nBytes, uint32_t nTimeout );
25 virtual size_t write( const void *pBuf, size_t nBytes );
26
27 virtual long tell();
28 virtual void seek( long offset );
29 virtual void setPos( long pos );
30 virtual void setPosEnd( long pos );
31 virtual bool isEOS();
32 virtual bool isOpen();
33
34 virtual void flush();
35
36 virtual bool canRead();
37 virtual bool canWrite();
38
39 virtual bool isReadable();
40 virtual bool isWritable();
41 virtual bool isSeekable();
42
43 virtual bool isBlocking();
44 virtual void setBlocking( bool bBlocking=true );
45
46 Bu::FString getAddress() const;
47
48 private:
49 int nSocket;
50 bool bActive;
51 FString sReadBuf;
52 };
53}
54
55#endif