36 lines
755 B
C++
36 lines
755 B
C++
#ifndef ZUTIL_NET_SOCKETSTREAM
|
|
#define ZUTIL_NET_SOCKETSTREAM
|
|
|
|
#include <iostream>
|
|
#include "socketio.h"
|
|
using namespace std;
|
|
|
|
const size_t BUFFER_SIZE = 100;
|
|
|
|
namespace zutil{
|
|
class SocketStreamBuffer : public streambuf{
|
|
private:
|
|
SocketIO &soc;
|
|
|
|
char pBuffer[BUFFER_SIZE];
|
|
char gBuffer[BUFFER_SIZE];
|
|
char *pBeg, *pCur, *pEnd;
|
|
char *gBeg, *gCur, *gEnd;
|
|
|
|
typedef char_traits<char> Tr;
|
|
protected:
|
|
//virtual int uflow();
|
|
virtual int underflow();
|
|
//virtual streamsize xsgetn(char_type *s, streamsize n);
|
|
|
|
virtual int overflow(int = Tr::eof());
|
|
//virtual streamsize xsputn(const char_type *s, streamsize n);
|
|
//virtual int sync();
|
|
|
|
public:
|
|
SocketStreamBuffer(SocketIO &s);
|
|
};
|
|
}
|
|
|
|
#endif
|
|
|