Re: Improved socket handling?

From: Date: Fri, 16 Dec 2005 18:13:38 +0000
Subject: Re: Improved socket handling?
References: 1 2 3  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-6411@lists.php.net to get a copy of this message
What I don't quite understand is that what I suggested initially is exactly now serial communication works! The 16550 UART chip has a buffer in it, and uses a hardware interrupt when the buffer fills. The cpu stops whatever it was doing, handles the data in the buffer, emptying it out. Thus, the serial port can operate more/less independently of the O/S and not tie everything else up while a transfer is underway. But, the use of fopen() and fgets() "linearize" operations, such that when copying data, if nothing comes thru the pipe for a while, the program appears "hung" until either: 1) you use fsockopen() and reach a specified timeout on the connection; 2) The buffer limit specified in fgets() is reached, or 3) When using fgets() on a connection, a newline character comes thru the pipe. I can set the stream to non-blocking mode, and do a loop, but even with that, you're still running a while() loop and that's very resource intensive. So, when doing RPC over TCP, (EG: SOAP/XML, or just retrieving a webpage) the program appears "choppy" and unresponsive. It just seems to me that it should be possble to open a socket, define a callback for the socket, and then have the callback address data when a threshold of input is received, as an event, sort of like a passive fgets(). -Ben On Wednesday 14 December 2005 05:37, Christian Weiske wrote: > Hello all, > > > there is another way, you can use gtk :: timeout_add, it will call a > > function(can be from an object) every x miliseconds(seconds?) > > On 12/14/05, Tabber Watts <tabber.watts@gmail.com> wrote: > > That works only if the main loop is running and isn't blocked - and by > copying the file, it is blocked. > > -- > Regards/MfG, > Christian Weiske > -- "The best way to predict the future is to invent it." - XEROX PARC slogan, circa 1978

« previous php.gtk.general (#6411) next »