Browse Subversion Repository
Contents of /connection/UdpipCtrl.h
Parent Directory
| Revision Log
Revision 279 -
( show annotations)
( download)
( as text)
Wed Mar 12 05:28:19 2008 UTC
(16 years, 2 months ago)
by satofumi
File MIME type: text/x-chdr
File size: 1375 byte(s)
adjust tab index
| 1 |
#ifndef UDPIP_CTRL_H |
| 2 |
#define UDPIP_CTRL_H |
| 3 |
|
| 4 |
/*! |
| 5 |
\file |
| 6 |
\brief UDP/IP 接続 |
| 7 |
|
| 8 |
\author Satofumi KAMIMURA |
| 9 |
|
| 10 |
$Id$ |
| 11 |
*/ |
| 12 |
|
| 13 |
#include "ConnectionInterface.h" |
| 14 |
#include <memory> |
| 15 |
|
| 16 |
|
| 17 |
namespace beego { |
| 18 |
class UdpipCtrl : public ConnectionInterface { |
| 19 |
|
| 20 |
UdpipCtrl(const UdpipCtrl& rhs); |
| 21 |
UdpipCtrl& operator = (const UdpipCtrl& rhs); |
| 22 |
|
| 23 |
struct pImpl; |
| 24 |
const std::auto_ptr<pImpl> pimpl; |
| 25 |
|
| 26 |
public: |
| 27 |
enum { |
| 28 |
ClientMode = 0, //!< 送信専用として初期化 |
| 29 |
TimeoutDummy = 0, |
| 30 |
}; |
| 31 |
|
| 32 |
/*! |
| 33 |
\brief 引数付きのコンストラクタ |
| 34 |
|
| 35 |
\params port [i] 受信待ちのポート番号 |
| 36 |
|
| 37 |
port を ClientMode にした場合、送信専用のオブジェクトが生成される。この場合、connect() を呼び出して送信先を設定すること。 |
| 38 |
*/ |
| 39 |
explicit UdpipCtrl(long port = ClientMode); |
| 40 |
~UdpipCtrl(void); |
| 41 |
|
| 42 |
const char* what(void); |
| 43 |
bool connect(const char* host, long port); |
| 44 |
void disconnect(void); |
| 45 |
bool isConnected(void); |
| 46 |
bool changeBaudrate(long baudrate); |
| 47 |
int send(const char* data, int size); |
| 48 |
|
| 49 |
/*! |
| 50 |
\attention timeout は無視され、ノンブロッキングで応答が返される |
| 51 |
*/ |
| 52 |
int recv(char* data, int size, int timeout); |
| 53 |
int size(int timeout = 0); |
| 54 |
void clear(void); |
| 55 |
void skip(int total_timeout); |
| 56 |
void flush(void); |
| 57 |
|
| 58 |
void disconnect(const char* host, long port); |
| 59 |
|
| 60 |
// !!! 受信先の情報取得かな? |
| 61 |
}; |
| 62 |
}; |
| 63 |
|
| 64 |
#endif /* !UDPIP_CTRL_H */ |
|