<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Emulate parts of netstat functionality through socket hack in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/emulate-parts-of-netstat-functionality-through-socket-hack/m-p/2587403#M592833</link>
    <description>Hi Vincent,&lt;BR /&gt;&lt;BR /&gt;thanks for looking at netstat's sources.&lt;BR /&gt;&lt;BR /&gt;I would have done this with my Linux distro's netstat as well.&lt;BR /&gt;&lt;BR /&gt;Blimy, 7000 lines of code?&lt;BR /&gt;&lt;BR /&gt;That's what I sort of feared, and why I posted here.&lt;BR /&gt;&lt;BR /&gt;Unfortunately it looks as there aren't many HP-UX admin folks interested in this stuff, gathering from the overwhelming response to this post :-(&lt;BR /&gt;</description>
    <pubDate>Thu, 04 Oct 2001 09:34:54 GMT</pubDate>
    <dc:creator>Ralph Grothe</dc:creator>
    <dc:date>2001-10-04T09:34:54Z</dc:date>
    <item>
      <title>Emulate parts of netstat functionality through socket hack</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/emulate-parts-of-netstat-functionality-through-socket-hack/m-p/2587401#M592831</link>
      <description>Hi system hackers / networkers,&lt;BR /&gt;&lt;BR /&gt;I couldn't quite make up my mind which would be the appropriate section for this posting (either  Languages or Networking).&lt;BR /&gt;Indeed, this isn't anything especially HP-UX specific, but rather common Unix BSD Socket fair.&lt;BR /&gt;But I'm sure there are many experienced system hackers among you sysadmins.&lt;BR /&gt;I wish to write a wee prog / script which stats sockets of AF_INET *without* falling back to a system call to netstat.&lt;BR /&gt;I would want to do this in Perl with the Socket module, or the more comfortable OO module IO::Socket (which inherits from IO::Handle).&lt;BR /&gt;I know that the system calls of the socket library are 1:1 adaptations to Perl so any suggestions in C would also be very welcome.&lt;BR /&gt;Having read quite a bit about socket programming in Perl I now would know how to open a socket, bind it to a port, put it into listening mode, and make it accept connections.&lt;BR /&gt;Even how to trap dreaded PIPE signals,  use syslog, change euid, chroot, disociate from the terminal, auto-background and serve clients, preforking, multiplexing, or simple forking.&lt;BR /&gt;I also read how to write clients that connect to a server.&lt;BR /&gt;What I didn't find though, was how to simply stat already established (or listening) sockets, say to simply count the number of connectios to a certain port.&lt;BR /&gt;As a last resort I think I could get the sources of a GNU netstat, and try to understand how they did it.&lt;BR /&gt;But I thought that maybe some of you also know, and could give me a little hint.&lt;BR /&gt;&lt;BR /&gt;Many thanks&lt;BR /&gt;Ralph</description>
      <pubDate>Mon, 01 Oct 2001 08:58:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/emulate-parts-of-netstat-functionality-through-socket-hack/m-p/2587401#M592831</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2001-10-01T08:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: Emulate parts of netstat functionality through socket hack</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/emulate-parts-of-netstat-functionality-through-socket-hack/m-p/2587402#M592832</link>
      <description>There's about 7000 lines of C code in netstat on my FreeBSD system.  You can get the code at &lt;A href="http://www.freebsd.org" target="_blank"&gt;www.freebsd.org&lt;/A&gt; - I'm sure it's in there somewhere.&lt;BR /&gt;&lt;BR /&gt;I think this is what you're looking for:&lt;BR /&gt; struct ngpcb *this, *next;&lt;BR /&gt;        struct ngpcb ngpcb;&lt;BR /&gt;        struct ngsock info;&lt;BR /&gt;        struct socket sockb;&lt;BR /&gt;  /* Read in socket structure */&lt;BR /&gt;  kread((u_long)ngpcb.ng_socket, (char *)&amp;amp;sockb, sizeof(sockb));</description>
      <pubDate>Tue, 02 Oct 2001 17:00:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/emulate-parts-of-netstat-functionality-through-socket-hack/m-p/2587402#M592832</guid>
      <dc:creator>Vincent Fleming</dc:creator>
      <dc:date>2001-10-02T17:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Emulate parts of netstat functionality through socket hack</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/emulate-parts-of-netstat-functionality-through-socket-hack/m-p/2587403#M592833</link>
      <description>Hi Vincent,&lt;BR /&gt;&lt;BR /&gt;thanks for looking at netstat's sources.&lt;BR /&gt;&lt;BR /&gt;I would have done this with my Linux distro's netstat as well.&lt;BR /&gt;&lt;BR /&gt;Blimy, 7000 lines of code?&lt;BR /&gt;&lt;BR /&gt;That's what I sort of feared, and why I posted here.&lt;BR /&gt;&lt;BR /&gt;Unfortunately it looks as there aren't many HP-UX admin folks interested in this stuff, gathering from the overwhelming response to this post :-(&lt;BR /&gt;</description>
      <pubDate>Thu, 04 Oct 2001 09:34:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/emulate-parts-of-netstat-functionality-through-socket-hack/m-p/2587403#M592833</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2001-10-04T09:34:54Z</dc:date>
    </item>
  </channel>
</rss>

