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]

Reply via email to