首先要在test.h檔中
struct hdr_test{
int type;//要加一個變數在這,不要去用到它,這樣packet header 的指標才不會出錯
double send_time;
char state;
int size_;
int& size() { return size_; }
static int offset_;
inline static int&offset(){return offset_;}
inline static hdr_test* access(const Packet* p){
return (hdr_test*)p->access(offset_);
}
};
當初卡這裡卡超久, 這樣就就可以好好利用自己的packet了
沒有留言:
張貼留言