TCP Resource Information
Overview
This NetBurner embedded application demonstrates system resource monitoring capabilities by providing real-time information about TCP buffers, network sockets, and file descriptors. The application is designed to help developers understand and monitor network resource usage in embedded systems.
Features
The application provides three main monitoring functions:
- System Buffer Monitoring: Display the number of free system buffers
- Socket Resource Tracking: Show available network sockets and file descriptors
- Dynamic Resource Testing: Create and close listening sockets to demonstrate resource consumption
System Requirements
- NetBurner Hardware
- NetBurner SDK (tested with revision 3.5.4)
- Active network connection
Application Structure
Core Functions
The application utilizes three key system functions for resource monitoring:
Menu System
The application provides an interactive serial menu with the following options:
- Show free buffers and sockets - Displays current resource availability
- Add a listen socket, display info, and close the socket - Demonstrates resource consumption by creating a temporary listening socket on port 10000
- Get extra fd count - Shows the count of extra file descriptors
Usage
- Compile and deploy the application to your NetBurner device
- Connect to the device via serial terminal
- The application will automatically initialize the network and display the menu
- Enter the number corresponding to your desired action:
- Press '1' to view current resource status
- Press '2' to test socket creation and see resource impact
- Press '3' to check extra file descriptor count
Important Notes
Resource Management
- Each active socket (listening or connected) consumes system resources
- When the system runs out of buffers or sockets, it cannot accept incoming connections or make outgoing connections
- The listening socket test (option 2) temporarily uses port 10000 with a backlog of 5 connections
Network Initialization
- The application waits up to 10 seconds for an active network connection during startup
- System diagnostics are enabled by default (consider disabling for production builds)
Code Structure
main.cpp
UserMain() - Main application entry point
showMenu() - Display menu options
processCommand() - Handle user input
System Functions - Network resource monitoring
Development Notes
- System diagnostics are enabled for development purposes
- The code is designed for continuous operation with a command loop
- Error handling is implemented for socket operations