home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.protocols.tcp-ip      TCP and IP network protocols.      14,669 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 14,624 of 14,669   
   younes korbi to All   
   Extract socket TCP informations with str   
   03 Mar 23 02:11:45   
   
   From: youneskorbi1999@gmail.com   
      
   I am currently working on extracting TCP information such as cwnd size, RTT,   
   and retransmission rate. I have created a function in the client socket to   
   achieve this. The function sends data and measures the TCP information. It   
   also writes the information    
   to files for further analysis.   
      
      
   void send_data(int sock, char buffer[], FILE *rate, FILE *cwnd, FILE *rtt) {   
       int sent_bytes, total_sent_bytes = 0;   
       double cwnd_size;   
       struct tcp_info info;   
       socklen_t len = sizeof(info);   
       time_t start, end, last = time(NULL); // last: temps de la dernière mesure   
       start = time(NULL);   
      
       while (total_sent_bytes < DATA_SIZE) {   
           sent_bytes = send(sock, buffer, BUFFER_SIZE, 0);   
           if (sent_bytes < 0) {   
               perror("send() failed");   
               exit(EXIT_FAILURE);   
           }   
      
           end = time(NULL);   
           total_sent_bytes += sent_bytes;   
      
           if (difftime(end, last) == 1.0) { // si une seconde s'est écoulée   
               if (getsockopt(sock, SOL_TCP, TCP_INFO, &info, &len) == -1) {   
                   perror("getsockopt");   
                   exit(1);   
               }   
      
               cwnd_size = (info.tcpi_snd_cwnd * info.tcpi_snd_mss) / 1024;   
      
               fprintf(cwnd, "%ld,%f\n", end-start, cwnd_size);   
      
               fprintf(rtt, "%ld,%u\n", end-start, info.tcpi_rtt);   
      
               last = end; // mise à jour du temps de la dernière mesure   
           }   
       }   
   }   
      
      
      
   However, I am still confused about the unit of RTT (milliseconds or   
   microseconds) as the results of RTT are larger than the ping results. I would   
   also like to extract information about BBR such as BDP. Can someone guide me   
   on how to extract this    
   information?   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca