NetBurner 3.5.6
PDF Version
Multiple TCP Interface Test

TCP Multiple Interface Test

Overview

This NetBurner application demonstrates TCP client functionality with support for multiple network interfaces. The application provides a web-based interface for testing TCP connections to remote servers using various connection methods and network interfaces.

Application Description

The TCP Multiple Interface Test is a comprehensive example that showcases different ways to establish TCP connections from a NetBurner device. It consists of two main components:

  1. **Web Interface (clientweb.cpp)** - Provides an HTML form for configuring and initiating TCP connections
  2. **Main Application (main.cpp)** - Initializes the system and starts the HTTP server

Features

Connection Testing Methods

The application tests multiple TCP connection approaches:

  • Standard Connection - Basic TCP connection using connect()
  • Non-blocking Connection - Asynchronous connection using NoBlockConnect()
  • Interface-specific Connections - Connections via specific network interfaces
  • IPv4 and IPv6 Support - Dual-stack networking capabilities

Web Interface

The web interface allows users to:

  • Specify destination IP address (auto-populated with client's IP)
  • Set destination port number (defaults to 2000)
  • Initiate connection tests through a web form
  • View connection results in the console output

Key Functions

SendMsg(IPADDR destIp, int destPort)

Main function that performs comprehensive connection testing by:

  • Testing standard and non-blocking connections
  • Iterating through all available network interfaces
  • Testing both IPv4 and IPv6 connections (when available)
  • Attempting connections via interface number and interface IP

TestConnect(int fd, const char *msg)

Helper function that:

  • Validates connection file descriptors
  • Waits for connection establishment (2-second timeout)
  • Reports connection status and local interface information
  • Properly closes connections after testing

Web Callback Functions

  • WebDestPort() - Displays current destination port in web form
  • WebDestIp() - Displays current destination IP in web form
  • WebShowClientIp() - Shows the client's IP address
  • PostCallBack() - Processes form submissions and initiates connections

Usage

Setup

  1. Compile and deploy the application to NetBurner hardware
  2. Connect the device to your network
  3. Note the device's IP address from the console output

Testing Connections

  1. Open a web browser and navigate to the device's IP address
  2. The form will auto-populate with your client IP as the destination
  3. Modify the destination IP and port as needed
  4. Click submit to initiate connection tests
  5. Monitor console output (via MTTTY) for detailed connection results

Prerequisites

  • A TCP server must be running at the specified destination IP and port
  • NetBurner provides TcpServerWin.exe in the \nburn\pctools directory for testing

Network Interface Testing

The application systematically tests connections through:

IPv4 Interfaces

  • Direct interface number specification
  • Interface IP address specification
  • Both standard and non-blocking variants

IPv6 Interfaces (when enabled)

  • Interface number specification
  • All valid IPv6 prefixes on each interface
  • Standard and non-blocking connection methods

Console Output

Connection attempts generate detailed logging including:

  • Connection method being tested
  • Source IP address and interface number
  • Success/failure status with error codes
  • Timeout notifications for failed connections

Error Handling

The application includes error handling for:

  • Invalid connection parameters
  • Connection timeouts (2-second limit)
  • Network interface enumeration failures
  • Form processing errors

Configuration

Default Values

  • Default destination port: 2000
  • Connection timeout: 5 seconds
  • Status check timeout: 2 seconds

Compilation Options

  • IPv6 support can be enabled/disabled via #ifdef IPV6
  • System diagnostics are enabled by default (consider disabling for production)

Development Notes

This example serves as a comprehensive reference for:

  • NetBurner TCP client implementation
  • Multi-interface network programming
  • Web-based device configuration
  • IPv4/IPv6 dual-stack networking
  • Non-blocking socket operations