Advanced: Using the Comm Port
This how-to demonstrates how to control a communications port from .NET.
Since the .NET Framework does not support direct control of the Comm Port,
a separate class is used that provides direct Win32 API calls. (Note: Comm Port
is synonymous with COM Port, Serial Port or RS232 port.)
Featured Highlights:
This tutorial demonstrates how to use the Comm Port to communicate. In
particular, it discusses:
-
Testing to see if the Comm Port is available for use.
-
Using the Comm Port to communicate with a modem.
-
Use Win32 API calls to control communication with the Comm Port.
Requirements:
-
Microsoft Visual Studio.NET Professional or greater.
-
Windows 2000 or Windows XP.
-
A modem installed on one of the Comm Ports. (for example most laptops include a
modem).
Running the Sample:
To run the sample:
-
Download and unzip the code into a directory of your choice.
-
Doubleclick the VB.NET How-To Using the Comm Port.sln
file.
-
Click the buttons on the form to test the functionality.
-
Examine the code in the sample to understand how the code works.
Additional Files in this Sample:
Rs232.vb - This file provides the structure for the
class which is used to control access to the Comm Port. The code
for this file can also be found on www.gotdotnet.com