TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:3532] help with gtk program



I will take a look at the gtk_idle_add() call that very usable.

I am quite uncomfortable with pipes. I do not know why but I find
them kind of unwieldy. But I could try using the message IPC 
mechanism with the gtk_idle_add().

The code resets the setuid() immediately after opening the
raw socket. 

I thought of parsing the traceroute output as
an option but I would have to run as many traceroute processes
as there are sites that I want to get a response from and then
process management is now quite messy. With
my own traceroute function I can manage all the traceroutes
from within one program. 

Thanks
sandipan

Shawn T . Amundson wrote:
> 
> Only do GTK+ code on one thread.
> 
> The best way to organize this would probably be to open up a pipe,
> fill it in a non-gtk thread and read it in the gtk thread when idle, so
> a gtk_idle_add() call.  I haven't really done any thread programming.
> 
> Also, setting a GTK+ program setuid is strongly discouraged, so don't
> do it.  How about just parsing traceroute output?  Or creating a second
> binary which does just what you want, and open that and work with it.
> Or just be really careful and get rid of root privilages before you do
> any GTK code.
> 
> -Shawn
> 
> On Mon, Jan 18, 1999 at 05:11:35PM -0600, Sandipan Panigrahi wrote:
> > Hi,
> >
> > I was playing with gtk and came up with a little
> > program that takes sitenames/ip addresses as input
> > and calculates round trip times and hops to the
> > destinations.
> >
> > The round trip/hops code I borrowed from the ping and
> > traceroute source. This runs on a thread of its
> > own, scheduling icmp packets to be sent to each
> > destination every so often and also receiveing return icmp
> > packets.
> >
> > Each icmp packet it recieves it updates a CLIST in GTK.
> >
> > The problem is that the CLIST does not get refreshed
> > as soon as the data is written to the screen, but seems
> > kind of at random. I have a feeling this is because the data
> > is getting updated from an external thread and not from
> > within the gtk main loop control.
> >
> > So I would like to know any way I can implement this ?
> > One way would be I guess to emit user defined signals from
> > the other thread instead of just calling the gtk functions.
> >
> > This is just a program I have been using to learn gtk and
> > one possible use of this was to see if I could do a search
> > for a file from a site like ftpsearch.lycos.com/ and
> > then try locate the best site for download.
> >
> > I do not think that a round trip time and a hop count will
> > be enough to decide on which is a good place to download from
> > but I was wondering if it was possible to get some estimate from
> > them. It would be nice if I could also figure out a way to
> > find out the bandwidth and load of the server to help decide
> > a good download site in addition to round trip and hops.
> >
> > Appreciate any ideas/help.
> > Oh and you can download the code and try it out if you like from
> > (binary from) http://www.frontiernet.net/~pani/probe
> > (source from) http://www.frontiernet.net/~pani/probe-0.1.tar.gz
> >
> > Also this has to be run as root, because it opens raw ports
> > which as I understand from the traceroute code can be done
> > only by root. So use very carefully if you must. Also any ideas
> > on how I can avoid having to run this as root this would be great !
> >
> > Thanks,
> > sandipan
> >