SerialPort.Close
----------------

Closes serial port.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [SerialPort](component_SerialPort.md) | [3.0](newinversion30.md) | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ❌ No |

MBS( "SerialPort.Close"; PortReference ) 

**MBS**( **"SerialPort.Close"** /\* Closes serial port. \*/  
**$PortReference**) /\* The reference number of the port.   
Or a list of reference numbers.  
  
You get this number from [SerialPort.Open](SerialPortOpen.md) when you open the port. e.g. $port \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PortReference | The reference number of the port.    Or a list of reference numbers.      You get this number from [SerialPort.Open](SerialPortOpen.md) when you open the port. | $port |

### Result

Returns OK on success.

### Description

Closes serial port.  
### Examples

Open port and close it:

 $port = MBS ( "[SerialPort.Open](SerialPortOpen.md)"; "COM1" )  
$r = MBS ( "[SerialPort.Write](SerialPortWrite.md)"; $port ; "Hello")  
$r = MBS ( "SerialPort.Close"; $port )  
### See also

- [SerialPort.Clear](SerialPortClear.md)
- [SerialPort.CloseAll](SerialPortCloseAll.md)
- [SerialPort.List](SerialPortList.md)
- [SerialPort.Open](SerialPortOpen.md)
- [SerialPort.OpenPath](SerialPortOpenPath.md)
- [SerialPort.Read](SerialPortRead.md)
- [SerialPort.Write](SerialPortWrite.md)

### Example Databases

- [Network/Serial Port](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Network/Serial%20Port.shtml#3ScriptAnchor_)

### Blog Entries

- [Serial Port functions for MBS Filemaker Plugin](https://www.mbsplugins.de/archive/2012-12-01/Serial_Port_functions_for_MBS_/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 18th August 2014 , last changed 29th October 2026

  
[SerialPort.ClearDataAvailableHandler](SerialPortClearDataAvailableHandler.md) - [SerialPort.CloseAll](SerialPortCloseAll.md)

[HTML Version](SerialPortClose.shtml)