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

2007-05-02 Thread Man-wai Chang

[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?


I think both Fedora Core and Ubuntu do it. Check out their RPM/DEB spec 
file for compiling the packages.


--
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10)  Linux 2.6.21.1
  ^ ^   19:58:01 up 4 days 4:51 0 users load average: 0.06 0.11 0.04
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: sockets (again)

2002-11-25 Thread Stephan Seidt
Hi,

You have to choose a protocol for AF_INET sockets.
Try getprotobyname() with tcp and udp to get one.

bye

On Mon, 25 Nov 2002 10:24:46 -0800
[EMAIL PROTECTED] (Gareth Thomas) wrote:

 Hi,
 
 I really need some help here because I am going to lose my mind otherwise!!
 A script that was running fine Friday has decided not to work for no
 apparent reason today. The problem seems to be with a socket_create that
 just stops the script, so I created a simple test script as shown below to
 see what happens. When I run this is simply drops out at the socket_create,
 no error message, nothing. Again this worked fine Friday and nothing has
 changed on my machine. I am running 4.2.3 on Win2K... any ideas? Help!!
 
 
 G.
 
 $zone = 192.168.0.60;
 $port = 1;
 $command = play;
 
 echo('here');
 
 $slip_socket = socket_create (AF_INET, SOCK_STREAM, 0);
 
 echo('here 2');
 
 if ($slip_socket  0) {
echo socket_create() failed: reason:  . socket_strerror ($slip_socket)
 . \n;
 } else {
$result = socket_connect ($slip_socket, $zone, $port);
if ($result  0) {
   echo socket_connect() failed.\nReason: ($result)  .
 socket_strerror($result) . \n;
}
 }
 
 $command=$command.\n;
 echo('Sending command: '.$command.' for '.$zone.'\n');
 socket_write ($slip_socket, $command, strlen ($command));
 
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Sockets

2002-09-23 Thread Philip Hallstrom

Yes.  See the online manual notes in the Socket Functions section for
links to examples.

On Mon, 23 Sep 2002, Martin W Jørgensen wrote:

 Is it possible to read and write to multiple sockets at once with php?

 Can anyone please answer that question?



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: sockets

2002-01-29 Thread Mike Frazer

Are you referring to PHP sockets or C sockets?  PHP sockets are an
implementation of C sockets (which is why most of the actiones needed are
the same in PHP but are somewhat simplified).

If you mean PHP sockets, you can try taking a look at WhoisPro, a
Whois/NICNAME script I wrote to understand how to implement sockets in PHP.
If you mean C sockets, well, I'm currently learning them myself.  Let me
know which you need and I can try to get you some resources for them.

Mike Frazer




Kunal Jhunjhunwala [EMAIL PROTECTED] wrote in message
03dd01c1a8f9$eb909a10$0301a8c0@CONFUSED">news:03dd01c1a8f9$eb909a10$0301a8c0@CONFUSED...
 hey..
 does anyone know of any good resources for using sockets? which will also
 explain using sockets to connect to various protocols? like ftp, httpd,
 mysql etc? Also, somewhere one can read on writing a connection deamon...
 Thanks!
 Regards,
 Kunal Jhunjhunwala




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: sockets

2002-01-29 Thread Kunal Jhunjhunwala

Hey Mike,
I am looking for PHP sockets.. hence the php mailing list :P I hvent found
any decent resource on it.. orielly article is good for complete beginers..
but i was looking for something more detailed... any books anyone can
recommend would do too.. but i would prefer source to study :)
Regards,
Kunal Jhunjhunwala
- Original Message -
From: Mike Frazer [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 30, 2002 4:08 AM
Subject: [PHP] Re: sockets


 Are you referring to PHP sockets or C sockets?  PHP sockets are an
 implementation of C sockets (which is why most of the actiones needed are
 the same in PHP but are somewhat simplified).

 If you mean PHP sockets, you can try taking a look at WhoisPro, a
 Whois/NICNAME script I wrote to understand how to implement sockets in
PHP.
 If you mean C sockets, well, I'm currently learning them myself.  Let me
 know which you need and I can try to get you some resources for them.

 Mike Frazer




 Kunal Jhunjhunwala [EMAIL PROTECTED] wrote in message
 03dd01c1a8f9$eb909a10$0301a8c0@CONFUSED">news:03dd01c1a8f9$eb909a10$0301a8c0@CONFUSED...
  hey..
  does anyone know of any good resources for using sockets? which will
also
  explain using sockets to connect to various protocols? like ftp, httpd,
  mysql etc? Also, somewhere one can read on writing a connection
deamon...
  Thanks!
  Regards,
  Kunal Jhunjhunwala
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: sockets

2002-01-29 Thread Michael Sims

At 01:22 AM 1/30/2002 +0530, Kunal Jhunjhunwala wrote:
Hey Mike,
I am looking for PHP sockets.. hence the php mailing list :P I hvent found
any decent resource on it.. orielly article is good for complete beginers..
but i was looking for something more detailed... any books anyone can
recommend would do too.. but i would prefer source to study :)

Here are my unqualified opinions:

Knowing how to use PHP sockets is as simple of using fsockopen() to open a 
connection and return a file pointer, and then using fgets() and fputs() to 
read from the socket and write to it.

Of course, the tricky part is knowing WHAT to write, and what to read, and 
what to do with it after you have read it.  In my experience, RFCs are the 
best source of information here.  For example, if you want to use PHP 
sockets to write a custom mail function, then the SMTP RFCs would be 
invaluable.  Same for FTP, or HTTP.

Of course things get trickier when you're talking about opening a direct 
TCP connection to a MySQL server, or something similar.  It's easy enough 
to know that you need to connect to port 3306, but without understanding 
the protocol MySQL uses (including the handshaking and authentication) 
you're not going to get very far.  And again as far as I know there is no 
such thing as a MySQL RFC, but perhaps they have programmer's references on 
their site.  If all else fails then it's time to start reading the source 
code. :-)

Of course this begs the question as to why you are trying to establish a 
socket connection to a MySQL server when PHP already has excellent support 
for MySQL.  So I guess I will end with the question that I should have 
began with:  What exactly are you trying to accomplish? :-)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Sockets on FreeBSD Mac OS X

2001-10-03 Thread Devon Weller


Thanks for your help.  Here is some more information:

I am running the process from the command line as root.  I also tried
several different ports, all with the same result.

I don't think you need any special permission to bind to a port above
1024. If so, I couldn't find anything out about it.

Any other ideas?

Thanks,
- Devon



In article 04c401c14bc4$6a1ddde0$c801a8c0@Lynchux100, [EMAIL PROTECTED]
(Richard Lynch) wrote:

 Wild Guess:
 
 Your OS is configured to not allow nobody to bind port 12345, and PHP is
 running within Apache as nobody...
 
 Check out what sort of limitations are put upon users binding ports...
 
 If I was a real Un*x guru, I'd even know what command tells you that... :-|
 
 --
 WARNING [EMAIL PROTECTED] address is an endangered species -- Use
 [EMAIL PROTECTED]
 Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
 Volunteer a little time: http://chatmusic.com/volunteer.htm
 - Original Message -
 From: Devon Weller [EMAIL PROTECTED]
 Newsgroups: php.general
 To: [EMAIL PROTECTED]
 Sent: Tuesday, October 02, 2001 11:02 AM
 Subject: Sockets on FreeBSD Mac OS X
 
 
 
  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
  for FreeBSD?  If so, I would be very happy.
 
  --
  Devon Weller
  [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Sockets on FreeBSD Mac OS X

2001-10-02 Thread Richard Lynch

Wild Guess:

Your OS is configured to not allow nobody to bind port 12345, and PHP is
running within Apache as nobody...

Check out what sort of limitations are put upon users binding ports...

If I was a real Un*x guru, I'd even know what command tells you that... :-|

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Devon Weller [EMAIL PROTECTED]
Newsgroups: php.general
To: [EMAIL PROTECTED]
Sent: Tuesday, October 02, 2001 11:02 AM
Subject: Sockets on FreeBSD Mac OS X



 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
 for FreeBSD?  If so, I would be very happy.

 --
 Devon Weller
 [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Sockets

2001-09-19 Thread Chris Lee

is this even a php related question? post some code and an example site and
we'll see what we can do.

--

  Chris Lee
  [EMAIL PROTECTED]



Jonathan Hilgeman [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I run a web application that opens a socket using cURL and sends data to a
 payment gateway and then receives confirmations, etc... Sometimes, a
visitor
 clicks multiple times and I have the program check to see if a transaction
 is already in process, and if so, it redirects them to a page where they
can
 check to see whether the transaction has gone through. So now I have 1
 thread/request going, doing the processing, and returning the data, and a
 second thread where the visitor can check to see if thread 1 has come back
 from processing or not. Normally, this works okay.

 SOMETIMES, thread 1 does not come back with data from the gateway, as if
the
 connection had timed out. Sometimes the gateway has processed the
 transaction, and sometimes not. So I would like to know if there's a
program
 or something that will allow me to either log socket communication, or to
 monitor the sockets, etc... Can anyone help me out with this?

 - Jonathan







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: sockets question

2001-08-21 Thread CC Zona

In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Gregor Jaksa) wrote:

 i have login.php where i do
 $socket_handle = fsockopen($server, $port);
 
 now in add.php i would like to send msg to $socket_handle socket...

include(login.php);

http://php.net/include has more info.

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]