Hi Guys,
I'm supposed to create a tcp client to interface with a server that supposedly only reads/writes in ascii (etx,stx characters). I am trying to create a non www/http connection.
1) socket_create
2) socket_connect
3) socket_read
4) socket_write
5) socket_read
6) hopefully read/write some more until closing socket
I'm having problems reading the response (#5). Here's some of the code i have regarding step 5.
//translated message = <stx>01<etx>
$message = chr(2).chr(48).chr(49).chr(3);
socket_write($sock,$message,strlen($message)) or die("no write");
$changed_socks = socket_select($sock, $write = NULL, $except = NULL, 1);
$data = socket_read($sock,1024);
I've tried using this to interact with a smtp server on a basic level and had no problems reading/writing commands into it. Seems that socket reads do not have problems with systems that return "\n" to know it's the end of line, but anything else...it dies.
Any ideas on how to read back something that has an <etx> character?
Any help would be most welcome, as i've been up so many long nites trying to find out how to do it and i'm afraid the deadline is approaching much too soon
:queasy: