Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 604391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:02:00+00:00 2026-05-13T17:02:00+00:00

I would like to write an application like a netstat – to show all

  • 0

I would like to write an application like a netstat – to show all the active connections and the open ports respectively. The problem is that I don’t know how to do it – I’ve done some network programming but in general it was some simple server-client packet and simple TCP and UDP packets sending/receiving.

I looked at the netstat code but it looks really complex. I am also reading the Unix Network Programming book and waiting for my copies of TCP/IP Illustrated (the 1 and 2 vol).

Any advice guys ? Anyone’s got experience with stuff like this ? If does, can someone help me a bit in here ? The important things to do etc. etc. ? I’ll appreciate every helpful answer.

Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:02:00+00:00Added an answer on May 13, 2026 at 5:02 pm

    You can do this, but realize that implementation will be operating system specific. This is because every OS exposes its counters and statistics differently.

    For example, on Linux, you can get most of the statistics by parsing the files in /proc/net. Dumping the contents of /proc/net/dev gives you the list of interfaces (along with some stats).

    # cat /proc/net/dev
    Inter-|   Receive                                                |  Transmit
     face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
        lo:1417676206 2810305    0    0    0     0          0         0 1417676206 2810305    0    0    0     0       0          0
      eth0:3780840146 96049486    0    0    0     0          0         0 2202685287 17436558    0    0    0     0       0          0
    

    Or, parsing /proc/net/netstat will give you protocol (TCP/IP) statistics:

    # cat /proc/net/netstat 
    TcpExt: SyncookiesSent SyncookiesRecv SyncookiesFailed EmbryonicRsts PruneCalled RcvPruned OfoPruned OutOfWindowIcmps LockDroppedIcmps ArpFilter TW TWRecycled TWKilled PAWSPassive PAWSActive PAWSEstab DelayedACKs DelayedACKLocked DelayedACKLost ListenOverflows ListenDrops TCPPrequeued TCPDirectCopyFromBacklog TCPDirectCopyFromPrequeue TCPPrequeueDropped TCPHPHits TCPHPHitsToUser TCPPureAcks TCPHPAcks TCPRenoRecovery TCPSackRecovery TCPSACKReneging TCPFACKReorder TCPSACKReorder TCPRenoReorder TCPTSReorder TCPFullUndo TCPPartialUndo TCPDSACKUndo TCPLossUndo TCPLoss TCPLostRetransmit TCPRenoFailures TCPSackFailures TCPLossFailures TCPFastRetrans TCPForwardRetrans TCPSlowStartRetrans TCPTimeouts TCPRenoRecoveryFail TCPSackRecoveryFail TCPSchedulerFailed TCPRcvCollapsed TCPDSACKOldSent TCPDSACKOfoSent TCPDSACKRecv TCPDSACKOfoRecv TCPAbortOnSyn TCPAbortOnData TCPAbortOnClose TCPAbortOnMemory TCPAbortOnTimeout TCPAbortOnLinger TCPAbortFailed TCPMemoryPressures TCPSACKDiscard TCPDSACKIgnoredOld TCPDSACKIgnoredNoUndo TCPSpuriousRTOs TCPMD5NotFound TCPMD5Unexpected
    TcpExt: 0 0 7053 2480 0 0 0 0 0 0 136514 0 0 0 0 4732 1291978 48 10938 0 0 726917 0 14734 0 3505285 23 3285967 4288783 963 56625 82 294 218 85 153 80 817 739 4861 176075 7864 246 3859 1647 285964 13690 54668 25710 599 4775 0 0 10792 21 12994 1492 0 305 27 0 946 0 0 0 1178 5175 3188 353 0 0
    IpExt: InNoRoutes InTruncatedPkts InMcastPkts OutMcastPkts InBcastPkts OutBcastPkts
    IpExt: 0 0 372 14 269538 0
    

    Or /proc/net/udp gives you UDP connection information:

    # cat /proc/net/udp
      sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode ref pointer drops             
      20: 0100007F:1194 00000000:0000 07 00000000:00000000 00:00000000 00000000     0        0 6788392 2 f6701b80 0                
      20: 4CE85CD0:1194 00000000:0000 07 00000000:00000000 00:00000000 00000000     0        0 6788384 2 f6703200 0                
      20: 4DE85CD0:1194 00000000:0000 07 00000000:00000000 00:00000000 00000000     0        0 6788379 2 f6701e00 0                
      39: 00000000:0AA7 00000000:0000 07 00000000:00000000 00:00000000 00000000   108        0 6790562 2 d2890f00 0                
      40: 00000000:11A8 00000000:0000 07 00000000:00000000 00:00000000 00000000   108        0 6790539 2 d2892580 0                
      68: 00000000:13C4 00000000:0000 07 00000000:00000000 00:00000000 00000000   108        0 6790505 2 d2892d00 0                
      87: 00000000:87D7 00000000:0000 07 00000000:00000000 00:00000000 00000000   106        0 6957 2 f67b0f00 0                   
      89: 00000000:11D9 00000000:0000 07 00000000:00000000 00:00000000 00000000   108        0 6790508 2 d2890500 0                
     105: 00000000:14E9 00000000:0000 07 00000000:00000000 00:00000000 00000000   106        0 6956 2 f67b2580 0                   
     116: 0100007F:01F4 00000000:0000 07 00000000:00000000 00:00000000 00000000     0        0 6788388 2 f6701900 0                
     116: 4CE85CD0:01F4 00000000:0000 07 00000000:00000000 00:00000000 00000000     0        0 6788382 2 f6701180 0                
     116: 4DE85CD0:01F4 00000000:0000 07 00000000:00000000 00:00000000 00000000     0        0 6788378 2 f6702f80 0                
     120: 0100007F:88F8 0100007F:88F8 01 00000000:00000000 00:00000000 00000000   107        0 6790576 2 f67b0a00 0
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 304k
  • Answers 304k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Every datasource of your report has a name (menu report->datasources,… May 13, 2026 at 8:54 pm
  • Editorial Team
    Editorial Team added an answer Use the java concurrent hashmap ConcurrentHashMap<object, object> table; public object… May 13, 2026 at 8:54 pm
  • Editorial Team
    Editorial Team added an answer OK, I've spent a few days in the weeds with… May 13, 2026 at 8:54 pm

Related Questions

I would like to write an application that will copy MP3 files to a
I would like to write an simple application able to retrieve some certain data
Please excuse my ignorance on the subject. I would like to write an application
I'm working on a Python library that interfaces with a web service API. Like
I'm writing an application in C that can be extended at runtime by means

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.