# Data Object - VirtualSerialPort(vim.vm.device.VirtualSerialPort)

Extends
  VirtualDevice
Since
  2.0

## Data Object Description

The `VirtualSerialPort` data object represents a serial port on a virtual machine. A virtual serial port uses one of the following backing types to specify how the virtual machine performs serial port operations.

- Network backing (`VirtualSerialPortURIBackingInfo`) supports a connection between the virtual machine and a resource on the network. The virtual machine can initiate a connection with the network resource, or it can listen for connections originating from the network.
- Pipe backing (`VirtualSerialPortPipeBackingInfo`) supports I/O through a named pipe. The pipe connects the virtual machine to a host application or a virtual machine on the same host.
- File backing (`VirtualSerialPortFileBackingInfo`) supports output through the virtual serial port to a file on the same host.
- Physical serial port backing (`VirtualSerialPortDeviceBackingInfo`) supports a connection between the virtual machine and a device that is connected to a physical serial port on the host.
- ThinPrint backing (`VirtualSerialPortThinPrintBackingInfo`) provides driver-free printing.

When you use network backing, you can also configure a virtual serial port to use a virtual serial port concentrator. The virtual machine initiates a telnet connection with the concentrator, and the concentrator acts as a proxy between the virtual machine and a system on the network. By using a virtual serial port concentrator, you can maintain the connection between the virtual machine and the network resource when a vMotion event moves the virtual machine from one host to another. Without a virtual serial port concentrator, the connection would be lost. For information about using a serial port concentrator, see Using a Proxy with vSphere Virtual Serial Ports.

You can configure a virtual serial port when you create or reconfigure a virtual machine. For example, to create a virtual serial port with network backing, use the following sequence of operations. In this procedure, the virtual serial port uses a proxy and will accept a network connection.

1. Use the `QueryConfigOption` method to determine the backing options that are available on a host. The method returns a `VirtualMachineConfigOption` data object. The virtual machine configuration data includes a list of backing options (`backingOption`). The following pseudocode shows the path to the backing options.
   `VirtualMachineConfigOption.hardwareOptions.VirtualDeviceOption[].backingOption[]`
   The array of virtual device options can include a virtual serial port (`VirtualSerialPortOption`). The array of serial port backing options can include URI, file, pipe, or device backing options.
2. Use the `CreateVM_Task` method (or the `CreateChildVM_Task` method) to create the virtual machine and configure the virtual serial port backing. Create a `VirtualMachineConfigSpec` data object and nested data objects for the method's `config` parameter. The following pseudocode shows the resulting path to the backing information.
   `VirtualMachineConfigSpec.deviceChange[].device.backing`
   Set the direction property to "server" to direct the virtual machine to accept a connection. Set the serviceURI property to the URI for the host on which the virtual machine runs.

If you use physical device backing (`VirtualSerialPortDeviceBackingOption`), you should also use the `QueryConfigTarget` method to determine if a serial device is available before configuring device backing.

Properties

Name | Type | Description
--- | --- | ---
yieldOnPoll | xsd:boolean | Enables CPU yield behavior. If you set `yieldOnPoll` to `true`, the virtual machine will periodically relinquish the processor if its sole task is polling the virtual serial port. The amount of time it takes to regain the processor will depend on the degree of other virtual machine activity on the host. To use this property, the CPU yield option must be supported. (See the `yieldOnPoll` property for the virtual serial port option object.)
Properties inherited from VirtualDevice
backing, connectable, controllerKey, deviceInfo, key, slotInfo, unitNumber
Properties inherited from DynamicData
None

Show WSDL type definition
<complexType xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vsan="urn:vsan" name="VirtualSerialPort"> <complexContent> <extension base="vsan:VirtualDevice"> <sequence> <element name="yieldOnPoll" type="xsd:boolean"/> </sequence> </extension> </complexContent> </complexType>