Haukcode.Network 1.0.26

dotnet add package Haukcode.Network --version 1.0.26
                    
NuGet\Install-Package Haukcode.Network -Version 1.0.26
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Haukcode.Network" Version="1.0.26" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Haukcode.Network" Version="1.0.26" />
                    
Directory.Packages.props
<PackageReference Include="Haukcode.Network" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Haukcode.Network --version 1.0.26
                    
#r "nuget: Haukcode.Network, 1.0.26"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Haukcode.Network@1.0.26
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Haukcode.Network&version=1.0.26
                    
Install as a Cake Addin
#tool nuget:?package=Haukcode.Network&version=1.0.26
                    
Install as a Cake Tool

Haukcode.Network

A .NET library providing common network utilities and efficient binary I/O operations for network programming.

Quick Start

Installation

dotnet add package Haukcode.Network

Features

  • Network Adapter Discovery - Query network interfaces, IP addresses, and MAC addresses
  • Binary I/O - Efficient big-endian and little-endian binary readers/writers
  • Network Utilities - Multicast addresses, broadcast addresses, socket configuration

Usage Examples

Get Network Adapters

using Haukcode.Network;

// Get first available IP address
var (ipAddress, netMask, macAddress) = Utils.GetFirstBindAddress();

// Get all adapters
var adapters = Utils.GetCommonAdapters();
foreach (var adapter in adapters)
{
    Console.WriteLine($"{adapter.DisplayName}: {adapter.AllIpv4Addresses[0].IP}");
}

Binary I/O (Network Byte Order)

using Haukcode.Network;

// Write binary data
var buffer = new byte[1024];
var writer = new BigEndianBinaryWriter(buffer);
writer.WriteUInt16(0x1234);
writer.WriteUInt32(0x12345678);
writer.WriteString("Hello", 10);

// Read binary data
var reader = new BigEndianBinaryReader(buffer);
ushort value16 = reader.ReadUInt16();
uint value32 = reader.ReadUInt32();
string text = reader.ReadString(10);

Network Utilities

using Haukcode.Network;
using System.Net;

// Generate multicast address
IPAddress multicast = Utils.GetMulticastAddress(1); // 239.255.0.1

// Calculate broadcast address
IPAddress broadcast = Utils.GetBroadcastAddress(
    IPAddress.Parse("192.168.1.100"),
    IPAddress.Parse("255.255.255.0")); // 192.168.1.255

// Configure socket
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
Utils.SetSocketOptions(socket);

Key APIs

Network Utilities:

  • Utils.GetCommonAdapters() - Get ethernet and WiFi adapters
  • Utils.GetFirstBindAddress() - Get first available IP address
  • Utils.GetMulticastAddress(universeId) - Generate multicast address
  • Utils.GetBroadcastAddress(ip, netmask) - Calculate broadcast address
  • Utils.SetSocketOptions(socket) - Configure socket options

Binary I/O:

  • BigEndianBinaryReader / BigEndianBinaryWriter - Network byte order
  • LittleEndianBinaryReader / LittleEndianBinaryWriter - Little-endian
  • Supports: Int16, UInt16, Int32, UInt32, bytes, strings, GUIDs
  • Memory-efficient with Memory<T> and Span<T>

Documentation

For complete documentation, examples, and API reference, visit: https://github.com/HakanL/Haukcode.Network

License

MIT License - Copyright (c) 2024 Hakan Lindestaf

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Haukcode.Network:

Package Downloads
Haukcode.ArtNet

ArtNet library for .NET Core (.NET8+)

Haukcode.sACN

A simple sACN library for .NET Core

Haukcode.KiNet

A simple KiNet library for .NET Core

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.26 190 2/5/2026
1.0.22 1,807 12/13/2024
1.0.21 140 12/13/2024
1.0.20 156 12/12/2024
1.0.19 157 12/12/2024
1.0.18 175 12/12/2024
1.0.17 147 12/12/2024
1.0.16 237 12/12/2024
1.0.15 156 12/12/2024
1.0.14 161 12/12/2024
1.0.13 158 12/12/2024
1.0.12 227 12/9/2024
1.0.11 156 12/8/2024
1.0.10 419 5/22/2024
1.0.9 184 5/22/2024
1.0.8 174 5/22/2024
1.0.7 190 5/21/2024
1.0.6 200 5/8/2024
1.0.5 170 5/8/2024
1.0.4-main-30492096 163 5/8/2024
1.0.3-main-3a3b171e 165 5/8/2024