Net::HTTP::NB(3) User Contributed Perl Documentation Net::HTTP::NB(3)

# [SYNOPSIS](#SYNOPSIS)

```
 use Net::HTTP::NB;
 my $s = Net::HTTP::NB->new(Host => "www.perl.com") || die $@;
 $s->write_request(GET => "/");
 use IO::Select;
 my $sel = IO::Select->new($s);
 READ_HEADER: {
    die "Header timeout" unless $sel->can_read(10);
    my($code, $mess, %h) = $s->read_response_headers;
    redo READ_HEADER unless $code;
 }
 while (1) {
    die "Body timeout" unless $sel->can_read(10);
    my $buf;
    my $n = $s->read_entity_body($buf, 1024);
    last unless $n;
    print $buf;
 }
```

# [DESCRIPTION](#DESCRIPTION)

Same interface as "Net::HTTP" but it will never try multiple reads when the **read\_response\_headers()** or **read\_entity\_body()** methods are invoked. This make it possible to multiplex multiple Net::HTTP::NB using select without risk blocking.

If **read\_response\_headers()** did not see enough data to complete the headers an empty list is returned.

If **read\_entity\_body()** did not see new entity data in its read the value -1 is returned.

# [SEE ALSO](#SEE_ALSO)

Net::HTTP

2026-10-25 perl v5.44.0

---

Document: Net::HTTP::NB(3pm) from perl-net-http 6.24-r3 (Chainguard OS)
Source: https://github.com/libwww-perl/Net-HTTP.git
