mirror of
https://gitee.com/willfree/http_vpn.git
synced 2026-06-06 07:59:40 +08:00
29 lines
560 B
C++
29 lines
560 B
C++
#include <iostream>
|
|
#include "ndn_socket.h"
|
|
#define BUFF_SZ 500
|
|
using namespace std;
|
|
|
|
int main()
|
|
{
|
|
Ndn_socket ndn_socket;
|
|
ndn_socket.listen("/localhost/nfd/recv2") ;
|
|
|
|
char buff[BUFF_SZ];
|
|
int read_n = 0 ; //收到的数据总长度
|
|
int recv_count = 0 ;
|
|
|
|
while((read_n = ndn_socket.read(buff,BUFF_SZ)) > 0){
|
|
cout << "count = " << ++recv_count << endl ;
|
|
cout<<"recv buff: ";
|
|
for(int x=0;x<BUFF_SZ;x++){
|
|
cout<<buff[x];
|
|
}
|
|
cout<<endl;
|
|
cout << "recv len = " << read_n << endl ;
|
|
cout<<endl;
|
|
// cout<<endl<<endl<<endl<<endl;
|
|
}
|
|
|
|
return 0;
|
|
}
|