Last change
on this file since 3897 was 3544, checked in by ansari, 17 years ago |
debug classes RawInOutSocketStream et ajout d'envoi/reception de messages de header/trailer - Reza 24/10/2008
|
File size:
1.1 KB
|
Rev | Line | |
---|
[3542] | 1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
| 2 |
|
---|
| 3 | #ifndef SOCKRAWSTREAM_H_SEEN
|
---|
| 4 | #define SOCKRAWSTREAM_H_SEEN
|
---|
| 5 |
|
---|
| 6 | // Classe de flot brut sur socket - pour utilisation par les streams PPersist
|
---|
| 7 | // R. Ansari LAL IN2P3/CNRS 11/2005
|
---|
| 8 |
|
---|
| 9 | #include "machdefs.h"
|
---|
| 10 | #include "rawstream.h"
|
---|
| 11 | #include "swrapsock.h"
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | namespace SOPHYA {
|
---|
| 15 |
|
---|
| 16 | // Input flow over a socket
|
---|
| 17 | class RawInOutSocketStream : public RawInOutStream {
|
---|
| 18 | public:
|
---|
[3544] | 19 | RawInOutSocketStream(Socket& skt, size_t npaq_buff=16);
|
---|
[3542] | 20 | virtual ~RawInOutSocketStream();
|
---|
| 21 |
|
---|
| 22 | // Lecture
|
---|
| 23 | virtual int_8 tellg();
|
---|
| 24 | virtual RawInOutStream& read(char* s, uint_8 n);
|
---|
| 25 | // Ecriture
|
---|
| 26 | virtual int_8 tellp();
|
---|
| 27 | virtual RawInOutStream& write(const char* s, uint_8 n);
|
---|
| 28 |
|
---|
| 29 | protected:
|
---|
| 30 | size_t CopyToSendBuffer(const char* s, size_t n);
|
---|
| 31 | size_t CopyFromRecvBuffer(char* s, size_t n);
|
---|
| 32 | void SendBuffer();
|
---|
| 33 | void ReceiveBuffer();
|
---|
| 34 |
|
---|
| 35 | size_t Send(const char* s, size_t n);
|
---|
| 36 | size_t Receive(char* s, size_t n);
|
---|
| 37 |
|
---|
| 38 | Socket & _skt;
|
---|
| 39 | struct SRWBuff { char* buff; size_t sz, cpos; };
|
---|
| 40 | SRWBuff _rdbuff;
|
---|
| 41 | SRWBuff _wrbuff;
|
---|
| 42 | size_t _totnwr;
|
---|
| 43 | size_t _totnrd;
|
---|
| 44 | };
|
---|
| 45 |
|
---|
| 46 |
|
---|
| 47 | } // namespace SOPHYA
|
---|
| 48 |
|
---|
| 49 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.