AxSerial 5.1.1.5031

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

ActiveXperts Serial Port Component is a Serial Port Communication component for Windows developers.

  • Easy to use API
  • Control devices over a serial port
  • Single DLL, 64-bit and 32-bit
  • Samples available in C#, VB, ASP.NET, HTML, PHP, Javascript, Delphi and more

How to use

Find the online manual here

Or download the full package which includes a number of working examples for C#, VB.Net, ASP.NET, C++, etc.. here: ActiveXperts Download Area

Simple C# code sample to open a connection to a device and send commands and receive reponses

using System; using System.Collections.Generic; using System.Text; using System.IO; using AxSerial;

namespace QueryDevice { class Program { static void Main(string[] args) { ComPort objComport = new ComPort(); string strBaudRate = "";

  // ComPort: Clear (good practise)
  objComport.Clear();

  // A license key is required to unlock this component after the trial period has expired.
  // Assign the LicenseKey property every time a new instance of this component is created (see code below). 
  // Alternatively, the LicenseKey property can be set automatically. This requires the license key to be stored in the registry.
  // For details, see manual, chapter "Product Activation".
  /*
  objComport.LicenseKey = "XXXXX-XXXXX-XXXXX";
  */

  Console.WriteLine("ActiveXperts Serial Port Component {0}\nBuild: {1}\nModule: {2}\nLicense Status: {3}\nLicense Key: {4}\n", objComport.Version, objComport.Build, objComport.Module, objComport.LicenseStatus, objComport.LicenseKey);

  // Set Logfile (optional, for debugging purposes)
  objComport.LogFile = Path.GetTempPath() + "SerialPort.log";
  Console.WriteLine("Log file used: {0}\n", objComport.LogFile);

  objComport.Device = AskDevice( objComport );

  // If a direct port is used, query for the baudrate
  if( objComport.Device.Substring( 0, 3 ) == "COM" )
  {
    strBaudRate = Ask( "Enter baudrate (empty string means: default baudrate):", true );
    if( strBaudRate == "" ) 
      strBaudRate = "0";

    objComport.BaudRate = System.Int32.Parse( strBaudRate );
  }

  objComport.Open();
  Console.WriteLine("Open, result: " + objComport.LastError + " (" + objComport.GetErrorDescription(objComport.LastError) + ")");
  if( objComport.LastError == 0 )
  {
    // Set all Read functions (e.g. ReadString) to timeout after a specified number of millisconds
    objComport.ComTimeout = 1000;  // Timeout after 1000msecs        

    ReadResponse( objComport );
    while( WriteCommand( objComport ) )
    {
      ReadResponse( objComport );
    }
    objComport.Close();
    Console.WriteLine("Close, result: " + objComport.LastError + " (" + objComport.GetErrorDescription(objComport.LastError) + ")");
  }

  Console.WriteLine("Ready.");		
  System.Threading.Thread.Sleep(3000); // Sleep for 3 second before exit
}

static private string AskDevice(AxSerial.ComPort objComport)
{
  String strInput = "", strDevice = "";
  System.Int32 i, j;

  Console.WriteLine("Select a device: ");
  for (i = 0; i < objComport.GetDeviceCount(); i++)
  {
    Console.WriteLine("  " + i.ToString() + ": " + objComport.GetDeviceName(i).ToString());
  }
  for (j = 0; j < objComport.GetPortCount(); j++)
  {
    Console.WriteLine("  " + (i + j).ToString() + ": " + objComport.GetPortName(j).ToString());
  }

  while (strDevice == "")
  {
    Console.Write("  > ");
    strInput = Console.ReadLine();
    if ((System.Int32.Parse(strInput) < i))
      strDevice = objComport.GetDeviceName(System.Int32.Parse(strInput));
    else if (System.Int32.Parse(strInput) < i + j)
      strDevice = objComport.GetPortName(System.Int32.Parse(strInput) - i);
  }
  Console.WriteLine("  Selected device: " + strDevice + "\r\n");
  return strDevice;
}

static private string Ask(string strTitle, bool bAllowEmpty)
{
  String strInput, strReturn = "";

  Console.WriteLine(strTitle);
  do
  {
    Console.Write("  > ");
    strInput = Console.ReadLine();
    if (strInput.Length > 1)
      strReturn = strInput;
  } while (strReturn == "" && !bAllowEmpty);
  return strReturn;
}

static private void ReadResponse(AxSerial.ComPort objComport)
{
  string str;

  str = "notempty";
  objComport.Sleep(200);
  while (str != "")
  {
    str = objComport.ReadString();
    if (str != "")
      Console.WriteLine("  <- " + str);
  }
}

static private bool WriteCommand(AxSerial.ComPort objComport)
{
  string str;

  Console.Write("Enter command (enter QUIT to stop the program):\r\n  > ");
  str = Console.ReadLine();
  objComport.WriteString(str);
  return str.ToLower() != "quit";
}

} }

Support

Any questions or need an extension of the trial period? Please send us an email to: support@activexperts.com

Pricing and purchasing

This product is a fully functional 30 day trail.

Find more information about pricing and how to purchase or our sales page: ActiveXperts Customer Services

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
5.1.1.5031 107 6/15/2025