xyPortHelper 1.0.1

dotnet add package xyPortHelper --version 1.0.1
                    
NuGet\Install-Package xyPortHelper -Version 1.0.1
                    
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="xyPortHelper" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="xyPortHelper" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="xyPortHelper" />
                    
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 xyPortHelper --version 1.0.1
                    
#r "nuget: xyPortHelper, 1.0.1"
                    
#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.
#addin nuget:?package=xyPortHelper&version=1.0.1
                    
Install xyPortHelper as a Cake Addin
#tool nuget:?package=xyPortHelper&version=1.0.1
                    
Install xyPortHelper as a Cake Tool

xyPorts

xyPorts is a modular .NET library for managing, checking, and communicating over TCP and UDP ports. It offers simple wrapper classes for port analysis, message exchange, and listener control.


Table of Contents


Overview

This project was created to provide simple and reusable tools for working with TCP and UDP network ports. In addition to sending and receiving messages, it supports checking port availability and dynamically starting or stopping listeners.


Project Structure

xyPorts/
├── Basix/
│   ├── xyPort.cs
│   └── xyPortChecker.cs
├── TCP/
│   ├── xyTcpPort.cs
│   ├── xyTcpClient.cs
│   └── xyTcpListener.cs
├── UDP/
│   ├── xyUdpPort.cs
│   └── xyUdpClient.cs
└── Master/
    └── xyPortManager.cs

Available Classes

Namespace: xyPorts.Basix

  • xyPort
    Represents a generic port with properties like IsListening, IsExclusive, PortID, and Information.

  • xyPortChecker
    Provides methods to analyze open ports:

    • GetOpenPorts()
    • IsPortAvaillable(int)
    • ArePortsAvaillable(List<int>)

Namespace: xyPorts.TCP

  • xyTcpPort
    Specialized version of xyPort for TCP. Includes TcpClient, TcpListener, xyTcpClient, xyTcpListener, ConnectionInformation, Statistics.

  • xyTcpClient
    Methods to establish a connection and send messages:

    • ConnectTCP(string ip, ushort port, string message)
    • SendMsgTcp(...)
    • ReceiveResponseTCP(...)
  • xyTcpListener
    Starts and manages TCP listeners:

    • Listen(ushort port)
    • StopListeningTcp(ushort port)
    • SendConfirmationResponse(...)
    • ReceivedMessage as EventHandler

Namespace: xyPorts.UDP

  • xyUdpPort
    Specialized version of xyPort for UDP. Includes UdpClient, xyUdpClient, UdpStatistics, UdpReceiveResult.

  • xyUdpClient
    Methods for UDP communication:

    • ConnectUDP(string ip, ushort port, string message)
    • ReceiveDataUDP(...)
    • ClosePortUdp(...)

Namespace: xyPorts.Master

  • xyPortManager
    Top-level class to manage and control ports.
    Holds instances of xyPort, xyTcpPort, and xyUdpPort.
    Provides ClosePort(int port) to kill the process using the port.

Usage

// Example: Check port availability
var checker = new xyPortChecker();
bool isFree = checker.IsPortAvaillable(13000);

// Open a TCP connection
xyTcpClient.ConnectTCP("127.0.0.1", 13000, "Hello TCP!");

// Send a UDP message
xyUdpClient.ConnectUDP("127.0.0.1", 12824, "Hello UDP!");

// Start a TCP listener
var listener = new xyTcpListener();
listener.Listen(13000);

Dependencies

  • .NET Standard / .NET Core
  • xyToolz (for utilities like logging)
  • System.Net, System.Net.Sockets
  • Microsoft.Extensions.Logging

License

This project is licensed under the GNU General Public License v3.0 (GPLv3).
See the LICENSE file for more information.


Author

Project by ThrashingLaggard Part of xyToolz

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 140 4/29/2025
1.0.0 126 4/29/2025