jupe has asked for the wisdom of the Perl Monks concerning the following question:

This is a simple question (I think) about IO::Socket. Can I set TOS/ECN or Options on packets created with IO::Socket, or must I use a different module? The corollary is can I receive a packet with IO::Socket and gather the TOS/ECN and Options? Thanks for all your help!

Jeremy
www.loungeman.com

Edit by tye

Replies are listed 'Best First'.
Re: Can IO::Socket get/set TOS/ECN ?
by rob_au (Abbot) on Dec 20, 2002 at 23:20 UTC
    No, IO::Socket cannot set type-of-service (TOS) options as these are set at a lower level of the OSI stack (Network, Layer 3) - As already referenced by sauoq, the NetPacket modules can be used for the manual construction of such packets. In terms of delivery of such packets to the network, Net::Divert may be of use in this task.

    In terms of receiving or capturing packets and retaining lower level information, the Net::Pcap module is exceptionally effective at this task - Using this module it is quite easy to manually pull packets about and examine their contents. There is an introductory tutorial which I wrote for this module on this site here and examples of usage at:

     

    perl -le 'print+unpack("N",pack("B32","00000000000000000000001000000011"))'

Re: IO::Socket
by sauoq (Abbot) on Dec 20, 2002 at 22:50 UTC

    I think you'll need to use something like NetPacket to do that.

    -sauoq
    "My two cents aren't worth a dime.";