PEAR Manual
Prev |  | Next

# Example

Example -- using Net_Socket

## Example

Example 48-1. Sending and recieving data
    $socket = new Net_Socket() ;

    // open connection
    $socket->connect("http://www.example.com", 80, true, 30);

    // Send data including linebreak
    $socket->writeLine("String with data");

    // receive data until linebreak
    $result = $socket->readLine();

    // receive a number of data
    $result = $socket->read(512);

    // close connection
    $socket->disconnect();

Prev | Home | Next
Net_Socket::writeLine() | Up | Net_Traceroute