本文整理汇总了Java中javax.comm.PortInUseException类的典型用法代码示例。如果您正苦于以下问题:Java PortInUseException类的具体用法?Java PortInUseException怎么用?Java PortInUseException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PortInUseException类属于javax.comm包,在下文中一共展示了PortInUseException类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ISOProtocol
import javax.comm.PortInUseException; //导入依赖的package包/类
/**
* creates a new instance and opens the com-port.
*
* @param portNr
* the n-th serial port in the system starting with 1.
* @param timeout
* the maximal time in milliseconds that the sendRequest method
* blocks, before throwing an exception.
* @param baud
* the baud rate for the serial port communication.
* @param databits
* the databits for the serial port communication.
* @param stopbits
* the stopbits for the serial port communication.
* @param parity
* then parity for the serial port communication.
* @throws UnsupportedCommOperationException
* if setting port parameters fails
* @throws PortInUseException
* if opening port fails
* @throws IOException
* if geting in-/outputstream fails or if there are too many
* listeners for this port
*/
public ISOProtocol(int portNr, long timeout, int baud, int databits,
int stopbits, int parity) throws UnsupportedCommOperationException,
PortInUseException, IOException {
this.timeout = timeout;
String portName = getSerialPortNameForOS(portNr);
openPort(portName, baud, databits, stopbits, parity);
}