Hi, Trying to learn php sockets so I can use my mail server without mail()
If i use fsockopen to open the socket, then I fputs and fgets I can do that but sometimes I get a connection reset by peer, seems that if I don't fgets what the server wants to say or i don't fgets enough then the server gets mad. Why?
Instead if I try a function fpassthru which acording to the manual
Reads to EOF on the given file pointer from the current position and writes the results to the output buffer.
$fp=fsockopen("127.0.0.1",25);
fpassthru($fp);
fclose($fp);
ArGoSoft Mail Server Freeware, Version 1.8 (1.8.3.4)
Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\KFWS\htdocs\test\bbs\shit.asp on line 13
Seems it grabs the intial identification header. But then just sits there, why?
When does it reach EOF. The script just times out and whats worse is if I look at my server:
6/3/03 11:56:28 - Requested SMTP connection from 127.0.0.1
6/3/03 11:56:30 - ( 7) 220 ArGoSoft Mail Server Freeware, Version 1.8 (1.8.3.4)
6/3/03 11:57:30 - ( 7)
6/3/03 11:57:31 - Error: [10054] Connection reset by peer
6/3/03 11:57:31 - SMTP connection with 127.0.0.1 ended. ID=7
But I have tryed examples like
while (!feof($fp)) {
//read the data returned...
$res = fgets ($fp, 1024);
}
And this seems to also do the same, conection reset.
Can someone please help me understand?