View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Sanko Robinson > Net-BitTorrent-Protocol-1.0.2 > Net::BitTorrent::Protocol::BEP10



Annotate this POD


View/Report Bugs
Module Version: v1.0.0   Source   Latest Release: Net-BitTorrent-Protocol-1.5.3


Net::BitTorrent::Protocol::BEP23 - Packet Utilities for BEP10: Extension Protocol

Synopsis ^

    use Net::BitTorrent::Protocol::BEP10 qw[all];
    my $index = build_extended(
                                  {m => {'ut_pex' => 1, "\xC2\xB5T_PEX" => 2},
                                   p => 30,
                                   reqq   => 30,
                                   v      => "Net::BitTorrent r0.30",
                                   yourip => "\x7F\0\0\1",

Description ^

The intention of this protocol is to provide a simple and thin transport for extensions to the bittorrent protocol. Supporting this protocol makes it easy to add new extensions without interfering with the standard BitTorrent protocol or clients that don't support this extension or the one you want to add.

Importing from Net::BitTorrent::Protocol::BEP10 ^

There are three tags available for import. To get them all in one go, use the :all tag.


Packet types

For more on what these packets actually mean, see the Extension Protocol spec. This is a list of the currently supported packet types.


These create packets ready-to-send to remote peers. See Building Functions.


These are used to parse unknown data into sensible packets. The same packet types we can build, we can also parse. See Parsing Functions.

Building Functions ^

build_extended ( $msgID, $data )

Creates an extended protocol packet.

$msgID should be 0 if you are creating a handshake packet, >0 if an extended message as specified by the handshake is being created.

$data should be a HashRef of appropriate data.

Parsing Functions ^

These are the parsing counterparts for the build_ functions.

When the packet is invalid, a hash reference is returned with a single key: error. The value is a string describing what went wrong.

Return values for valid packets are explained below.

parse_extended( $data )

Returns an integer ID and a HashRef containing the packet's payload.

See Also ^ - Fast Extension

Author ^

Sanko Robinson <> -


License and Legal ^

Copyright (C) 2008-2012 by Sanko Robinson <>

This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or notes on the Artistic License 2.0 for clarification.

When separated from the distribution, all original POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See the clarification of the CCA-SA3.0.

Neither this module nor the Author is affiliated with BitTorrent, Inc.

syntax highlighting: