Re: [PHP] Sockets (reading)

2009-08-27 Thread Martin Scotta
On Wed, Aug 26, 2009 at 5:36 PM, Philip Thompson wrote: > On Aug 26, 2009, at 2:47 PM, Bob McConnell wrote: > > From: Philip Thompson >> >>> On Aug 26, 2009, at 11:56 AM, Bob McConnell wrote: >>> From: Philip Thompson > > During a socket read, why would all the requested number

Re: [PHP] Sockets (reading)

2009-08-26 Thread Philip Thompson
On Aug 26, 2009, at 2:47 PM, Bob McConnell wrote: From: Philip Thompson On Aug 26, 2009, at 11:56 AM, Bob McConnell wrote: From: Philip Thompson During a socket read, why would all the requested number of bytes not get sent? For example, I request 1000 bytes: This is actually in a loop,

RE: [PHP] Sockets (reading)

2009-08-26 Thread Bob McConnell
From: Philip Thompson > On Aug 26, 2009, at 11:56 AM, Bob McConnell wrote: >> From: Philip Thompson >>> >>> During a socket read, why would all the requested number of bytes not >>> get sent? For example, I request 1000 bytes: >>> >>> >> $data = @socket_read ($socket, 2048, PHP_BINARY_READ); >>> ?>

RE: [PHP] Sockets (reading)

2009-08-26 Thread Bob McConnell
From: Shawn McKenzie > Bob McConnell wrote: >> From: Philip Thompson >>> During a socket read, why would all the requested number of bytes not >> >>> get sent? For example, I request 1000 bytes: >>> >>> >> $data = @socket_read ($socket, 2048, PHP_BINARY_READ); >>> ?> >>> >>> This is actually in a

Re: [PHP] Sockets (reading)

2009-08-26 Thread Shawn McKenzie
Bob McConnell wrote: > From: Philip Thompson >> During a socket read, why would all the requested number of bytes not > >> get sent? For example, I request 1000 bytes: >> >> > $data = @socket_read ($socket, 2048, PHP_BINARY_READ); >> ?> >> >> This is actually in a loop, so I can get all the data i

Re: [PHP] Sockets (reading)

2009-08-26 Thread Philip Thompson
On Aug 26, 2009, at 11:56 AM, Bob McConnell wrote: From: Philip Thompson During a socket read, why would all the requested number of bytes not get sent? For example, I request 1000 bytes: This is actually in a loop, so I can get all the data if split up. So, for example, here's how the d

RE: [PHP] Sockets (reading)

2009-08-26 Thread Bob McConnell
From: Philip Thompson > > During a socket read, why would all the requested number of bytes not > get sent? For example, I request 1000 bytes: > > $data = @socket_read ($socket, 2048, PHP_BINARY_READ); > ?> > > This is actually in a loop, so I can get all the data if split up. So, > for examp

Re: [PHP] Sockets (reading)

2009-08-26 Thread Jim Lucas
Philip Thompson wrote: > Hi. > > During a socket read, why would all the requested number of bytes not > get sent? For example, I request 1000 bytes: > > $data = @socket_read ($socket, 2048, PHP_BINARY_READ); > ?> > > This is actually in a loop, so I can get all the data if split up. So, > for

Re: [PHP] Re: php sockets

2007-12-20 Thread vixle
With any code doing a basic socket functionality, the code that i gave in the original post is suppossed to connect to a deamon, and get a message from it , instead it "makes the deamon go crazy" in the sense that it starts endless looping and loads the system resources up to max. "Jim Lucas" <

Re: [PHP] Re: php sockets

2007-12-20 Thread Jim Lucas
vixle wrote: > well i mean even if we would not consider that particular piece of code as > an example of the code that i have issues with im still rather interesting > if theres some different between the socket model used by say, c++(winsock > in my case) and the sockets used in php > because

Re: [PHP] Re: php sockets

2007-12-20 Thread vixle
well i mean even if we would not consider that particular piece of code as an example of the code that i have issues with im still rather interesting if theres some different between the socket model used by say, c++(winsock in my case) and the sockets used in php because when made a simple c++

Re: [PHP] Re: php sockets

2007-12-19 Thread Nathan Nobbe
figured id top-post on this one, since the original message was so long.. i recommend debugging with a tool like wireshark. that way you can see whats in the packets going over the wire and hopefully it will lead to a solution. -nathan On Dec 19, 2007 12:54 AM, vixle <[EMAIL PROTECTED]> wrote:

[PHP] Re: php sockets

2007-12-18 Thread vixle
this code doesn't interact with php client while with c++ based one it works just fine. .anybody? #include #include #include #include using namespace std; int i = 0; int ar = 0; const int is = 50; SOCKET stack[is]; void clientserve(void* ws) { SOCKET wsocket = *(SOCKET*)ws; int fgotus

[PHP] Re: php sockets

2007-12-18 Thread vixle
this code doesn't interact with with php client while with c++ based one it works just fine. .anybody? #include #include #include #include using namespace std; int i = 0; int ar = 0; const int is = 50; SOCKET stack[is]; void clientserve(void* ws) { SOCKET wsocket = *(SOCKET*)ws; int f

Re: [PHP] Sockets as a module or a separate PHP CLI instance?

2007-05-02 Thread Richard Lynch
On Wed, May 2, 2007 6:29 am, [EMAIL PROTECTED] wrote: > I need to do some socket work on a production machine that is > constantly > busy so I don't dare re-compile php. Anybody know if it's possible to > load > the socket functions dynamically, maybe as if they were in a module? If you can do --w

Re: [PHP] Sockets as a module or a separate PHP CLI instance?

2007-05-02 Thread Oliver Block
Am Mittwoch, 2. Mai 2007 14:36 schrieb Oliver Block: > --with-socket=shared Actually it should be --enable-sockets=shared Regards, Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Sockets as a module or a separate PHP CLI instance?

2007-05-02 Thread Oliver Block
Am Mittwoch, 2. Mai 2007 13:29 schrieb [EMAIL PROTECTED]: > I need to do some socket work on a production machine that is constantly > busy so I don't dare re-compile php. Anybody know if it's possible to load > the socket functions dynamically, maybe as if they were in a module? It's possible if

Re: [PHP] Sockets problem

2007-03-21 Thread Adrian Gheorghe
Thanks for the answer. In the meantime I've managed to solve the problem be removing the pcntl_wait call. Actually I think this is a bug, because as I understand things pcntl_wait shouldn't block the main process, but I don't have experience with either sockets or Unix process, so I might be wrong

Re: [PHP] Sockets problem

2007-03-20 Thread Richard Lynch
On Tue, March 20, 2007 8:27 am, Adrian Gheorghe wrote: > I've sent a bug report earlier and it got marked as bogus, so I > decided to ask here about a possible solution. You can see the bug > report at http://bugs.php.net/bug.php?id=40864 Looks like a pretty cogent bug report to me... Perhaps Ton

Re: [PHP] sockets

2005-07-12 Thread Ahmed Saad
On 7/13/05, Greg Donald <[EMAIL PROTECTED]> wrote: > `php -h` tells you all the command line options.. and all the basic > fuctionality is covered in the manual online. Seems complete to me. ehmm you weren't refering to the CLI version but anyways, I'd be grateful to anyone who points me to more

Re: [PHP] sockets

2005-07-12 Thread Greg Donald
On 7/12/05, Ahmed Saad <[EMAIL PROTECTED]> wrote: > yeah the manual is completely drak when it comes to php CLI binary `php -h` tells you all the command line options.. and all the basic fuctionality is covered in the manual online. Seems complete to me. -- Greg Donald Zend Certified Engineer

Re: [PHP] sockets

2005-07-12 Thread Ahmed Saad
Hi André, On 7/12/05, André Medeiros <[EMAIL PROTECTED]> wrote: > Since there was no reference to that on the PHP manual, I thought about > mentioning it just to be safe. yeah the manual is completely drak when it comes to php CLI binary -- PHP General Mailing List (http://www.php.net/) To unsub

Re: [PHP] sockets

2005-07-12 Thread André Medeiros
Since there was no reference to that on the PHP manual, I thought about mentioning it just to be safe. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] sockets

2005-07-12 Thread Ahmed Saad
hi all, > On Tue, 2005-07-12 at 16:49 +0200, daro wrote: > Also remember to set_time_limit(0) ;) PHP ENTER CONFUSION The *CLI* version of php has no max execution time by default (0) - Where's the php CLI version in php4? [PHP_HOME]/cli/php.exe and it reads a php.ini if it was in the SAME direc

Re: [PHP] sockets

2005-07-12 Thread André Medeiros
Please, PLEASE "Reply to All"! Yes, you have to add something like --8<- while(true) { // code here if( $someConditionThatWillMakeMeExit ) { break; } sleep(1); // to prevent excessive processor

Re: [PHP] sockets

2005-07-12 Thread André Medeiros
On Tue, 2005-07-12 at 09:58 -0500, Greg Donald wrote: > On 7/12/05, daro <[EMAIL PROTECTED]> wrote: > > I don't know where should I put this script to be able to receive all > > datas and respond > > with proper strings. > > You would run the script as a shell script from the command line. > >

Re: [PHP] sockets

2005-07-12 Thread Hidayet Dogan
You should use/run it via PHP-CLI. It is a shell script. Ex: /usr/local/bin/php socket.php (on linux) or C:\PHP\php.exe socket.php (on windooz/M$-dos) Good luck. Hidayet Dogan On Tue, 12 Jul 2005, daro wrote: Hi. I'm writing a TCP/IP server and client. On your website I found ready php sc

Re: [PHP] sockets

2005-07-12 Thread André Medeiros
On Tue, 2005-07-12 at 16:49 +0200, daro wrote: > Hi. > I'm writing a TCP/IP server and client. > On your website I found ready php script http://pl2.php.net/sockets but I > have a question. > > For TCP/IP server the example script from your website has to be put on > server as index.php file an

Re: [PHP] sockets

2005-07-12 Thread Greg Donald
On 7/12/05, daro <[EMAIL PROTECTED]> wrote: > I don't know where should I put this script to be able to receive all datas > and respond > with proper strings. You would run the script as a shell script from the command line. On windows you can just save the code as a regular php script then sta

Re: [PHP] sockets - fine tunning

2003-10-28 Thread Raditha Dissanayake
Hi, I think curt is right about transfer encoding being a problem, however i feel it may not be 'the' problem. This timing issue looks like you are running into a 'blocking' kind of situation. Cosmin, Have you tried the 'Connection: close' header? Getting back to transfer encoding you might wan

Re: [PHP] sockets - fine tunning

2003-10-27 Thread Curt Zirzow
* Thus wrote Cosmin ([EMAIL PROTECTED]): > On Sun, 2003-10-26 at 15:30, Raditha Dissanayake wrote: > > are you getting any 1xx status codes from the web server? > > here are the full headers: > > Transfer-Encoding: chunked This is probably the problem. If you inspect your data, you'll notice that

Re: [PHP] sockets - fine tunning

2003-10-26 Thread Cosmin
On Sun, 2003-10-26 at 15:30, Raditha Dissanayake wrote: > are you getting any 1xx status codes from the web server? here are the full headers: HTTP/1.1 200 OK Date: Mon, 27 Oct 2003 06:15:30 GMT Server: Apache/1.3.27 (Unix) PHP/4.3.3 X-Powered-By: PHP/4.3.3 Transfer-Encoding: chunked Content-Type:

Re: [PHP] sockets - fine tunning

2003-10-26 Thread Raditha Dissanayake
are you getting any 1xx status codes from the web server? Cosmin wrote: I'm trying to make an application using XML-RPC, and I have the following problem: I use fsockopen() to simulate a POST to my local web-server. All goes very well except it's very very slow. Here is my code maybe someone coul

Re: [PHP] sockets - fine tunning

2003-10-25 Thread Cosmin
On Sat, 2003-10-25 at 17:42, Curt Zirzow wrote: > * Thus wrote Cosmin ([EMAIL PROTECTED]): > > I'm trying to make an application using XML-RPC, and I have the > > following problem: I use fsockopen() to simulate a POST to my local > > web-server. All goes very well except it's very very slow. Here

Re: [PHP] sockets - fine tunning

2003-10-25 Thread Curt Zirzow
* Thus wrote Cosmin ([EMAIL PROTECTED]): > I'm trying to make an application using XML-RPC, and I have the > following problem: I use fsockopen() to simulate a POST to my local > web-server. All goes very well except it's very very slow. Here is my > code maybe someone could tell me what I'm doing

[PHP] Re: php sockets was Re: [PHP] socket_write eats data - solved

2003-09-15 Thread Daniel Souza
Probably your problems about "i can send about seven messages per second" may be relationed to OS's tcp connection stream buffering... try to flush every fd after write to it. I wrote a multi-threaded (pcntl_fork()) application in phpcli using many sockets and they worked well... array iterations a

Re: [PHP] sockets

2002-11-21 Thread Chris Shiflett
I'm not sure if it would be helpful, but I wrote a quick PHP socket application that implements a specialized HTTP proxy. It's a quick hack of sorts, but I have found it to be very stable, and it uses the latest sockets API. It consists of only one small PHP script, and it's fairly well commented.

Re: [PHP] sockets

2002-11-08 Thread Marek Kilimajer
This is how sockets work, if you close the process holding the socket, the conection is closed. There is no function reopen_the_old_conection. You are not clear about what you are trying to achive, but maybe you should rethink your design. Gareth Thomas wrote: Hi, I am running 4.3.0pre2 on RH

Re: [PHP] Sockets

2002-10-07 Thread Marco Tabini
Yep, if you're using UNIX and compiling from source, you must add this switch to the command line when you're configuring and compiling PHP: --enable-sockets (e.g.: ./configure --enable-sockets). If you're using a prepackaged version (RPM or Windows) then you should look into the documentation

Re: [PHP] Sockets & 'requested address is not valid in its context'

2002-07-07 Thread Miguel Cruz
On Sat, 6 Jul 2002, Zac Hillier wrote: > I'm opening a port on a remote machine presently I'm using fsockopen() which > is fine for opening the port and sending data however I'm having trouble > reading data back from the port. > > So I've considered using socket functions but do not appear to be

Re: [PHP] sockets and flush()

2002-04-09 Thread Robert Cummings
MAIL PROTECTED]] > > Sent: Tuesday, April 09, 2002 11:12 AM > > To: dietrich > > Cc: [EMAIL PROTECTED] > > Subject: Re: [PHP] sockets and flush() > > > > > > dietrich wrote: > > > > > > i have a script that makes a socket connection about halfw

RE: [PHP] sockets and flush()

2002-04-09 Thread Matthew Luchak
Are you using ob_start () and ob_end_flush() ? If not then declaring ob_start () as the very first "mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 09, 2002 5:39 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: [PHP] sockets and flush() no tables. my test script prints a s

RE: [PHP] sockets and flush()

2002-04-09 Thread Dietrich Ayala
no tables. my test script prints a single string prior to the sockets code. thx, dietrich > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 09, 2002 11:12 AM > To: dietrich > Cc: [EMAIL PROTECTED] > Subject: Re: [P

Re: [PHP] sockets and flush()

2002-04-09 Thread Robert Cummings
dietrich wrote: > > i have a script that makes a socket connection about halfway through the > page. > > nothing on the page prints until the socket operation is finished, even if i > call flush() prior to the socket operation. > > does anyone now of a way to force PHP to output the buffer prio

RE: [PHP] Sockets with windows / win32 - 'call to undefined function: ...'

2002-04-04 Thread Maxim Maletsky
Socket() function does not exist in PHP at all. Use fsockopen() instead. http://www.php.net/fsockopen Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com > -Original Message- > From: Odd Arne Beck [mailto:[E

Re: [PHP] Sockets and Telnet

2002-03-19 Thread Nick Winfield
On Tue, 19 Mar 2002, Hunter, Ray wrote: > Has anyone created a telnet session in php with sockets and can give me some > help on setting one up? Take a look at PHP Shell to see how it's done. http://www.gimpster.com/php/phpshell/index.php Cheers, Nick Winfield. -- PHP General Mailing List

Re: [PHP] Sockets

2002-02-04 Thread Mike Frazer
As I said, you're probably better off with fsockopen() anyway. Remember, the oure socket functions are experimental (or at least were last time I checked that part of the manual) and you never really know with experimental things. As well, they may change at any time, rendering your scripts usel

Re: [PHP] Sockets

2002-02-04 Thread Evan Nemerson
That's the first thing I tried- doesn't work with the lower-level sockets. (the socket_* functions) Right now I have an fsockopen version, and I'm commenting out the socket version- hopefully I'll be able to get it to work later. Thanks, but do you have any other ideas??? -Evan On Mond

Re: [PHP] sockets

2002-02-04 Thread Evan Nemerson
the Servlet does not respond to Get requests.. > > any more ideas pl??? > > Thnx... > > sands > > -Original Message- > From: Evan Nemerson [mailto:[EMAIL PROTECTED]] > Sent: segunda-feira, 4 de Fevereiro de 2002 15:25 > To: Sandeep Murphy > Cc: [EMAIL PROTEC

Re: [PHP] Sockets

2002-02-04 Thread Mike Frazer
I've found fsockopen to be very reliable. I've done a few socket scripts with PHP (WhoisPro, et al). I believe the easiest way to check for a remotely closed socket is to do an fgets() and check for EOF: while (!feof($connection)) { $buffer .= fgets($connection, 4096); // 4096 is the ch

RE: [PHP] sockets

2002-02-04 Thread Sandeep Murphy
: [PHP] sockets > The server does listen on port 80 as i can access it via browser... > "http://srv157:7001/Palmeira2Application/palmeira2.servlets.communicator.Co >m municator"; Am I missing something here? What's "srv157:7001"? Why don't you first try

Re: [PHP] sockets

2002-02-04 Thread Bogdan Stancescu
> The server does listen on port 80 as i can access it via browser... > "http://srv157:7001/Palmeira2Application/palmeira2.servlets.communicator.Co >m municator"; Am I missing something here? What's "srv157:7001"? Why don't you first try http://www.google.com? Bogdan -- PHP General Mailing Li

RE: [PHP] sockets

2002-02-04 Thread Sandeep Murphy
Nemerson [mailto:[EMAIL PROTECTED]] Sent: segunda-feira, 4 de Fevereiro de 2002 15:25 To: Sandeep Murphy Cc: [EMAIL PROTECTED] Subject: Re: [PHP] sockets This should help you. It is the fsockopen version of what I posed about 6 hours ago. function getdata ($host, $port, $data) { $fp

Re: [PHP] sockets

2002-02-04 Thread Evan Nemerson
This should help you. It is the fsockopen version of what I posed about 6 hours ago. function getdata ($host, $port, $data) { $fp = fsockopen ( $host, $port, $ec, $es, 5.0); if ( !$fp ) { exit ("ERROR $ec: $es\n"); } fputs ($fp, $data);

Re: [PHP] Sockets

2002-02-03 Thread Evan Nemerson
I am aware of cURL, but I want to just use the standard PHP stuff if I can because I plan on releasing this when I'm done, and want to KISS for other people. I know people have to compile PHP with sockets, but they will anyways for this project- I'm going to need socket_listen and socket_creat

Re: [PHP] Sockets

2002-02-03 Thread Jason G.
A quick note... If you are not aware of cURL (curl.haxx.se), then you may want to look into it. If you are, then please disregard this post. -Jason Garber At 11:06 PM 2/3/2002 -0800, Evan Nemerson wrote: >Anyone know if there is a way yet to see if a socket is still connected to a >host? I wan

Re: [PHP] Sockets on FreeBSD Mac OS X

2001-10-02 Thread Brad Hubbard
On Wed, 3 Oct 2001 02:02, Devon Weller wrote: > Has anyone successfully gotten socket functions to work with FreeBSD? > More specifically, Mac OS X? > > I always get the following error: Can't bind to port 12345, exiting. > > The script works fine on Linux machines. Is there a patch in the works

Re: [PHP] Sockets on FreeBSD Mac OS X

2001-10-02 Thread Mukul Sabharwal
Oops, socket_setopt($listener, SOL_SOCKET, SO_REUSEADDR, 1); = * Know more about me: http://www.geocities.com/mimodit * __ Do You Yahoo!? Listen to your Yahoo! Mail messages from

Re: [PHP] Sockets on FreeBSD Mac OS X

2001-10-02 Thread Mukul Sabharwal
Hi, A bind error means that the port is being used by another application, incase that's incorrect you can assure yourself by doing this : socket_setopt(listener, SOL_SOCKET, SO_REUSEADDR, 1); This function is undocumented (yet) and would require you to download the latest version from CVS. Ho

Re: [PHP] Sockets in Win98.

2001-08-09 Thread Tyler Longren
If you get the "call to undefined function" error, I'd say that it doesn't have the socket functions built in. I'm not positive, that'd be my guess though. Tyler Longren Captain Jack Communications [EMAIL PROTECTED] www.captainjack.com On Thu, 09 Aug 2001 15:19:40 +0100 "Michael Quinn" <[EMAI

Re: [PHP] sockets

2001-04-09 Thread Lindsay Adams
well, if they did, and they made a full telnet class, then great!! give us all the class!! BUT, if they wrote their own socket listener, essentially their own protocol, then it would work. but if you are using sockets to connect to a real telnet server (as it were) then you MUST have the negotia

RE: [PHP] sockets

2001-04-09 Thread Matthias Winkelmann
> -Original Message- > From: Lindsay Adams [mailto:[EMAIL PROTECTED]] > > No, your problem is most likely that you didn't do anything with > the telnet > negotiation phase. [..] That doesn't sound very encouraging :-( Anyway, I got that idea of splitting an application into a codebase

Re: [PHP] sockets

2001-04-09 Thread Lindsay Adams
No, your problem is most likely that you didn't do anything with the telnet negotiation phase. Read the RFC on telnet, and you will find that there is a whole client-server negotiation phase going on. Kinda like a modem handshake. It is really quite difficult, and no one has ported a Telnet class

Re: [PHP] sockets (long)

2001-04-05 Thread Joseph Blythe
Yasuo Ohgaki wrote: > set_nonblock() is in PHP C source, but not in the PHP Manual. May be it's dead? > > It seems it take one parameter (file descriptor), let us know if it works. I > might want to use it in the future :) Yasuo, There is one mention of set_nonblock() in the manual under acc

Re: [PHP] sockets (long)

2001-04-05 Thread Yasuo Ohgaki
set_nonblock() is in PHP C source, but not in the PHP Manual. May be it's dead? It seems it take one parameter (file descriptor), let us know if it works. I might want to use it in the future :) >From socket.c 529 /* {{{ proto bool set_nonblock(int fd) 530Sets nonblocking mode for file des

Re: [PHP] sockets (long)

2001-04-04 Thread Joseph Blythe
Plutarck wrote: > Very recently (a few days at most ago) someone was complaining about the > problem you are having. > > According to them they can't get the socket function to accept socket > nonblocking. > > It would seem that the function is broken, so you can't set nonblocking to a > valid

Re: [PHP] sockets (long)

2001-04-04 Thread Plutarck
Very recently (a few days at most ago) someone was complaining about the problem you are having. According to them they can't get the socket function to accept socket nonblocking. It would seem that the function is broken, so you can't set nonblocking to a valid value at the current time. Hopef

Re: [PHP] Sockets

2001-01-24 Thread Jason Brooke
The online manual has some working examples Also, using the socket funcs in Php isn't very different from using them in C - try searching www.google.com if the examples in the manual aren't enough jason - Original Message - From: "Boget, Chris" <[EMAIL PROTECTED]> To: "Php (E-mail)" <[