#include "fwp_confdefs.h"
#include "fwp.h"
-int main()
+int main(int argc, char* argv[])
{
+ int opt;
ssize_t len;
char buffer[1000000];
struct fwp_endpoint *repoint1;
bool opt_daemon = false;
fwp_endpoint_attr_init(&attr);
opt_daemon = true;
+ int stream_id = 7777;
+ int count = 0;
printf("Start\n");
+
+ while ((opt = getopt (argc, argv, "e:p:m:")) != -1) {
+ switch (opt) {
+ case 'p':
+ stream_id = atoi(optarg);
+ break;
+ case '?':
+ printf("Usage: %s -p stream_id\n",
+ argv[0]);
+ }
+ }
if (fwp_init() != 0) {
printf("FWP initialization failed!\n");
return -1;
}
- if (fwp_receive_endpoint_create(7777, &attr,&repoint1) < 0){
+ if (fwp_receive_endpoint_create(stream_id, &attr,&repoint1) < 0){
return -1;
}
printf("Receive endpoint created\n");
while(1) {
+ count++;
if ((len = fwp_recv(repoint1, buffer, sizeof(buffer), &from,
0)) < 0) {
perror("Error while receiving data");
return -1;
}
- else printf("Received - %d\n", len);//buffer);
+ else printf("%d received - %d\n", count, len);//buffer);
}
return 0;
}