Results 1 to 2 of 2

Thread: socket_recv, socket_read

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Location
    USA
    Posts
    75

    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

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Re: socket_recv, socket_read

    Try placing a newline after the text you're sending:

    PHP Code:
    socket_send($socket,"LIST\n",4,0); 
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width