|
-
Oct 26th, 2006, 01:29 PM
#1
Thread Starter
Lively Member
socket_recv, socket_read
Im connecting to an NNTP server. I create the socket and connect to it. I recieve the first line (+ok) but when I call either socket_recv, socket_read, or socket_recvfrom the script loops or freezes. Even when I send the list command(which works) and then try to read the socket it freezes. Any ideas why? Code included below.
PHP Code:
$socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
if(!$socket)
{
die("Socket Creation failed");
}
$result = socket_connect($socket,"news.cs.rit.edu",119);
if(!$result)
{
die("Connection failed");
}
socket_recv($socket,$buffer,1024,0);
echo $buffer; //Returns OK
socket_send($socket,"LIST",4,0);
socket_recv($socket,$buffer,1024,0);
echo $buffer;
-
Nov 22nd, 2006, 11:44 AM
#2
Stuck in the 80s
Re: socket_recv, socket_read
Try placing a newline after the text you're sending:
PHP Code:
socket_send($socket,"LIST\n",4,0);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|