Re: [gtk-list] Sockets and GTK 1.1.x



On Sat, Jan 09, 1999 at 04:48:27PM -0500, Mike Lindahl wrote:
> I am writing a program for a CS class and we were given a socket source
> file to work with.  It opens a socket and would normally be used for
> terminal applications (it is extra credit to be using GTK).  Thus, since
> it should be used for terminal, it blocks.  I don't think they would like
> it very much if I rewrote the network interface (and I don't know if I
> would be able to do it).  Now, the problem is that when I click on a
> button in GTK, the program goes into receive mode, so it is in an infinite
> loop as it is blocking.
[...] 
> Is there an easy way to solve the entire networking problem using
> signal-based sockets that is relatively easy to implement (either using
> GTK or some other thing, such as SIGIO) that anyone knows of??

If you use select() to block on the socket, you can tell GTK+ to do the
select so that it effectively doesn't block the entire application
(look it up in the header files somewhere, don't know the exact call
from the top of my head).

You could also use SIGIO. Or you could use (POSIX) threads or separate
processes.

-- 
Andreas E. Bombe <andreas.bombe@munich.netsurf.de>
http://home.pages.de/~andreas.bombe/

PGP 1024bit ID:0x886663c9 fingerprint: 30EC0973847B5583 C47A91D99DC54BB0
    2048bit ID:0xF62D5CC1 fingerprint: 136BBC1536B8B77A 200558E86FAAF8ED



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]