I guess, by stack, you mean protocol-stack? What platform, BTW (I assume *nix for a while)?

There's a loose coupling between TCP port-number and the underlying protocol, like documented here. But to be sure, you need to inspect some incoming/outgoing PDUs. pcap might come handy or wireshark.

Digging deeper, your Perl program could analyse the output of tshark (-n -V -S -l) for example. Here's a sample of

tshark -n -V -S -l | perl -ne 'print if /^\S/'
... Frame 82 (66 bytes on wire, 66 bytes captured) Ethernet II, Src: 01:16:XX:XX:XX:a4 (01:16:XX:XX:XX:a9), Dst: 00:XX:XX +:XX:d5:e6 (00:XX:XX:XX:d5:e6) Internet Protocol, Src: 192.168.XX.XXX (192.168.XX.XXX), Dst: 166.XX.X +X.XX (166.XX.XX.XX) Transmission Control Protocol, Src Port: 46289 (46289), Dst Port: 80 ( +80), Seq: 592, Ack: 176, Len: 0 ...
Looks like something, that can be converted into a stack...(some parts anonymised by using XX).

HTH


In reply to Re: explore tcp/ip stack by Perlbotics
in thread explore tcp/ip stack by sveni

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.