|
From: <php...@li...> - 2008-10-24 11:33:25
|
Hi, if the socket_* are available on all operating systems and in all PHP versions >= 5.1.4, I'd prefer this API over fwrite/fread. However, accoding to my tests on FreeBSD 4, Unix Domain Sockets communication is faster than TCP socket communication, even with ndelay switched off. Regards, Jost Boekemeier --- php...@li... <php...@li...> schrieb am Fr, 24.10.2008: > Von: php...@li... <php...@li...> > Betreff: Re: [Php-java-bridge-users] java.so module purpose? > An: php...@li... > Datum: Freitag, 24. Oktober 2008, 8:19 > I've learned more. My examples were wrong. Updated > examples at > http://vanstaveren.us/~trick/fbsd-nagle-localhost-errorcase/ > > My bug: I was not fread() / socket_read()'ing from the > opened stream > after sending packets from the client. So communication was > one-way. My > hacks on the send buffer size had fooled TCP into doing an > extra round > trip to the server which coincidentally caused the delay as > well. > Updated examples now actually send & recieve the same > packets as your > original java test case and the bug reproduces exactly in > both the > fsockopen and socket_ code. socket_set_option with > TCP_NODELAY works, > for the sockets example only of course. > > My speculations about buffers and fflush() not working were > false, I was > clearly mistaken... > > This means a few things: > 1) I'm now a lot more confident that socket_set_option > is a viable fix, > but I don't know if it's best to move PJB to use > this API just for this > reason. What do you think? My patch was accepted; the > constant > TCP_NODELAY is available as of PHP 5.2.7-RC2. > 2) After quite a bit of research, the streams library > (fsockopen/fwrite/fread) apparently does not expose a > method for me to > set socket options. I'll raise this on the PHP ML to > make sure I've not > missed something obvious. > > Might be viable to write a PHP function > stream_socket_{get,set}_option > which does the same thing as socket_{get,set}_option if > that's the best > route. > > Cheers, > Patrick > > > php...@li... wrote: > > Hi, > > > > it is true that PHP buffers data internally. But as > soon as read() is called on the same stream, the outgoing > data is flushed. The problem is really the "ack > delay" caused by BSD's socket implementation. > > > > I suggest to discuss this on the BSD or PHP mailing > list, as this affects all PHP applications running on BSD, > not only the PHP/Java Bridge. > > > > > > Regards, > > Jost Boekemeier > > > > > > > > > > > > > ------------------------------------------------------------------------- > > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > > Build the coolest Linux based applications with Moblin > SDK & win great prizes > > Grand prize is a trip for two to an Open Source event > anywhere in the world > > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > _______________________________________________ > > php-java-bridge-users mailing list > > php...@li... > > > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > > > > -- > Patrick "Trick" van Staveren > http://trick.vanstaveren.us > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK > & win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users |