[K12OSN] Try this utility to test your thin client network

Robert Arkiletian robark at gmail.com
Sun Nov 6 00:08:24 UTC 2005


I wrote this tiny C program to automate testing my thin client
network. All you need to do is compile it and then run it as root.
Root is required for ping to work in flood mode.

1) save the code below as a file. Say nettest.c
*make sure the last line is blank
2) $gcc nettest.c -o nettest
3) #./nettest
or you can save your output to a file like this
#./netstat > outputfile

//===============================
// A little utility to check thin client LTSP network
// Author: Robert Arkiletian

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {

        FILE* fp=popen("netstat -t -e|grep x11|sed -e 's/:/ /g'|\
awk '{print $6}'|grep -v root|sort|uniq","r");
        char ip[64];

        while ( fgets(ip,sizeof(ip)-1,fp) )
        {
                char ping[64]="ping -c100 -f -p aa ";
                system( strcat(ping,ip) );
        }

        pclose(fp);
        return 0;
}
//===============================

--
Robert Arkiletian
C++ GUI tutorial http://fltk.org/links.php?V19




More information about the K12OSN mailing list