Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8266887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:19:24+00:00 2026-06-08T05:19:24+00:00

I have an experiment set-up using two laptop machines , one acting as a

  • 0

I have an experiment set-up using two laptop machines , one acting as a transmitter and another as receiver. The transmitter continuously transmits packets of different sizes , depending on the time period of different timers that have been configured. The receiver captures these packets and calculates the PRR upon termination of the program.

The transmitter and receiver are separated by a distance of about just 6-7 feet

Is a packet-reception ratio of 0.87 normal for this TCP/IP set-up or is it on the lower side?

Transmitter:

 void sendMedicalStream(void) {

  timer_count ++;

  if(timer_count % 5 ==0) {        

  memcpy(pu8 ,(struct pulse_oxim_packet*)& oxim_packet , sizeof(struct 
              pulse_oxim_packet));
   x=send(s,pu8,sizeof(u8aSendBuffer),0); 
  }

  if(timer_count % 50 == 0) {    
   memcpy(pu8 ,(struct ecg_data*)& wifi_ecg_data , sizeof(struct ecg_data));
   x=send(s,pu8,sizeof(u8aSendBuffer),0);
  }

   if(timer_count % 10 == 0) {  
   memcpy(pu8 ,(struct resp_monitor_packet*)& rsp_mon_packet , sizeof(struct   
                                                              resp_monitor_packet));
   x=send(s,pu8,sizeof(u8aSendBuffer),0);
    }

    if(timer_count % 120 == 0) {  
    memcpy(pu8 ,(struct self_check_glucose_monitor_packet*)& gm_packet , sizeof(struct 
                           self_check_glucose_monitor_packet));
    x=send(s,pu8,sizeof(u8aSendBuffer),0);
   }

     if(timer_count % 30 == 0) {  
    memcpy(pu8 ,(struct self_check_weight_monitor*)& wm_packet , sizeof(struct 
                                                   self_check_weight_monitor));
     x=send(s,pu8,sizeof(u8aSendBuffer),0);
    }

  if(timer_count % 25 == 0) {  
   memcpy(pu8 ,(struct asthma_monitor*)& as_mon_packet , sizeof(struct asthma_monitor));
   x=send(s,pu8,sizeof(u8aSendBuffer),0);
   }

  if(timer_count % 35 == 0) {  
    memcpy(pu8 ,(struct  sc_blood_press_mon_packet*)& bp_mon_packet , sizeof(struct 
                      sc_blood_press_mon_packet));
    x=send(s,pu8,sizeof(u8aSendBuffer),0);
  }

 if(timer_count % 45 == 0) {  
  memcpy(pu8 ,(struct  insulin_pump_packet*)& ins_pump_packet , sizeof(struct 
                         insulin_pump_packet));
   x=send(s,pu8,sizeof(u8aSendBuffer),0);
  }


  if(timer_count % 15 == 0) { 
   memcpy(pu8 ,(struct  fetal_heart_monitor *)& fhm_packet , sizeof(struct 
                            fetal_heart_monitor));
    x=send(s,pu8,sizeof(u8aSendBuffer),0);
  }
   if(timer_count % 180 == 0) {  
   memcpy(pu8 ,(struct dialysis_machine *)& dial_mach_packet , sizeof(struct 
                      dialysis_machine));
   x=send(s,pu8,sizeof(u8aSendBuffer),0);

  }

  if(timer_count == 10000)
   timer_count = 0;
  }

 int main(int argc,char **argv)
  {

struct sockaddr_in sin;

 /* Packet Title DEtails */
    strcpy(fhm_packet.title,"Fetal-Heart-Rate-Monitor");
    strcpy(bp_mon_packet.title,"Blood-Pressure-Monitor");
    strcpy(ins_pump_packet.title,"Insulin-Pump-Monitor");
    strcpy(wm_packet.title,"Weight-Monitor");
    strcpy(as_mon_packet.title,"Asthma-Monitor");
    strcpy(gm_packet.title,"Glucose-Level-Monitor");
    strcpy(rsp_mon_packet.title,"Infant-Respiratory-Monitor");
    strcpy(dial_mach_packet.title,"Dialysis-Machine");


    /* Socket Details */   
    len=sizeof(struct sockaddr);

    if(argc==2){
    host =argv[1];
    }

   /* translates the host name into peer's IP address */

   hp=gethostbyname(host);
    if(!hp){
    fprintf(stderr,"duplex-talk : uknown host : %s\n",host);
    exit(1);
    }

   /* build address data structures */

    bzero((char *)&sin, sizeof(sin));
    sin.sin_family = AF_INET;
    bcopy(hp->h_addr,(char *)(&sin.sin_addr),hp->h_length);
    sin.sin_port = htons(SERVER_PORT);

     /* active open */
    if((s = socket(PF_INET,SOCK_STREAM,0))<0) {
    perror("duplex-talk : socket");
    exit(1);
     }

    if(connect(s, (struct sockaddr *)&sin, sizeof(sin)) <0) {
    perror("duplex-talk : connect");
    exit(1);
   }


  /* Timer Details */

  struct itimerval it_val;  /* for setting itimer */

   if (signal(SIGALRM, (void (*)(int)) sendMedicalStream) == SIG_ERR) {
   perror("Unable to catch SIGALRM");
    exit(1);
   }


   it_val.it_value.tv_sec =     MIN_INTERVAL/1000;
   it_val.it_value.tv_usec =    (MIN_INTERVAL*1000) % 1000000;   
   it_val.it_interval = it_val.it_value;

   if (setitimer(ITIMER_REAL, &it_val, NULL) == -1) {
   perror("error calling ECG setitimer()");
   exit(1);
   }


 /* main loop : get and send lines of text */
  int i=0,j=0;  
 while(1);

 }

Receiver :

 int main(int argc,char *argv)
  {
   char * pu8 = u8aSendBuffer;
   signal(SIGINT,INThandler);
struct sockaddr_in sin;
struct sockaddr addr;
socklen_t fromlen;
char buf[MAX_LINE];


len=sizeof(struct sockaddr);

/* build address data structues */

bzero((char *)&sin, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons(SERVER_PORT);

/* setup passive open*/

if((s=socket(PF_INET,SOCK_STREAM,0))<0) { 
      perror("duplex-talk:socket");
       exit(1);
   }

   if((bind(s,(struct sockaddr *)&sin, sizeof(sin))) < 0){

    perror("duplex-talk: bind");
    exit(1);
   }

    // listen
  listen(s,MAX_PENDING);

    if((new_s = accept(s,(struct sockaddr *)&sin, &len)) < 0) {
    perror("duplex-talk : accept");
     exit(1);
  }

  while(1)
  {


    recv(new_s,pu8,sizeof(u8aSendBuffer),0);

    p_ptr = (struct pulse_oxim_packet *)pu8;
    ecg_ptr = (struct ecg_data *)pu8;
    resp_mon_ptr = (struct resp_monitor_packet *)pu8;
    gmon_ptr = (struct self_check_glucose_monitor_packet *)pu8;
    wmon_ptr = (struct self_check_weight_monitor *)pu8;
    asmon_ptr = (struct asthma_monitor *)pu8;
    bp_mon_ptr = (struct sc_blood_press_mon_packet *)pu8;
    ins_pump_packet = (struct insulin_pump_packet *)pu8;
    ft_mon_ptr = (struct fetal_heart_monitor *) pu8; 
    dial_mach_ptr = (struct dialysis_machine *) pu8;     



  if( p_ptr != NULL && strcmp(p_ptr->title,"Pulse-Oximeter-Data") == 0) 
    recv_count++;
  if( ecg_ptr != NULL &&  strcmp( ecg_ptr->title,"ECG-Monitor-Data") == 0 )
    recv_count++;
  if( gmon_ptr != NULL &&  strcmp( gmon_ptr->title,"Glucose-Level-Monitor") == 0 )
     recv_count++;
  if( asmon_ptr != NULL &&  strcmp( asmon_ptr->title,"Asthma-Monitor") == 0 )
     recv_count++;
  if(wmon_ptr != NULL &&  strcmp( wmon_ptr->title,"Weight-Monitor") == 0 )
     recv_count++;
    if( ins_pump_packet != NULL && strcmp( ins_pump_packet->title,"Insulin-Pump-Monitor") 
                             == 0)
     recv_count++;
  if( bp_mon_ptr != NULL &&  strcmp(bp_mon_ptr->title,"Blood-Pressure-Monitor") == 0 )
     recv_count++;
  if( ft_mon_ptr != NULL &&  strcmp( ft_mon_ptr->title,"Fetal-Heart-Rate-Monitor") == 0 )
     recv_count++;
   if( dial_mach_ptr != NULL &&  strcmp( dial_mach_ptr->title,"Dialysis-Machine") == 0 )
     recv_count++;
   }

   return 0;
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:19:26+00:00Added an answer on June 8, 2026 at 5:19 am

    I’m not a networking expert, but if your transmitter is continuously transmitting packets, it’s quite possibly introducing far more interference with ACK packets than would normally be the case.

    My guess is that if you modify it very slightly so that it doesn’t saturate the connection, you’ll find you get a much higher packet reception ratio.

    EDIT: Having seen your code, I believe one possible problem is that even though you’ve created a stream-based socket, you’re not treating it as one – you’re assuming that you’ll get exactly one packet on each recv call:

    recv(new_s,pu8,sizeof(u8aSendBuffer),0);
    

    You should be using the return value from recv to see how many bytes have actually been received.

    It’s possible that you’re semi-okay to ignore it in this case due to having a very small receiving window (I don’t know what sizeof(u8aSendBuffer) is) but in generally you should not be treating the stream as a sequence of packets like you are: you should treat it as a stream of data, where you may or may not receive as much data as you ask for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement a one-to-many relation using Hibernate (in Java). I have two
I have made a simple, test program to experiment using classes. It creates a
Ok so part two of I have no will power experiment is: Summary Question
I have a set of experimental values. For instance, I have a value of
I thought it would be a cool experiment to have a for loop and
I am new to Ember.js. I have the following experiment in my HTML: <p>Username:
I have a branch called experiment. git checkout master echo 'some changes' > a.txt
I have a pet project with which I experiment with new features of C++11.
I have a data frame consisting of results from multiple runs of an experiment,
I am trying to experiment this parameter in MapReduce and I have some question.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.