# How to check if com Port is already being used by another application?

**URL:** <https://discourse.processing.org/t/how-to-check-if-com-port-is-already-being-used-by-another-application/37946>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [July 14, 2022, 11:29am UTC](https://discourse.processing.org/t/how-to-check-if-com-port-is-already-being-used-by-another-application/37946 "2022-07-14T11:29:09Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [July 14, 2022, 2:17pm UTC](https://discourse.processing.org/t/how-to-check-if-com-port-is-already-being-used-by-another-application/37946/2 "2022-07-14T14:17:19Z")

</div>

Hi  
Port options

```auto
// display serial port list 
println(Serial.list());
printArray(Serial.list());
// get the first available port (use EITHER this OR the specific port code below)
String portName = Serial.list()[0];

// get a specific serial port (use EITHER this OR the first-available code above)
String portName = "COM5";

// open the serial port
port = new Serial(this, portName, 115200);

```

May in this links some hints if you looking for something else

> **[Find active serial port from processing - Processing Forum](https://forum.processing.org/one/topic/find-active-serial-port-from-processing.html)**
>
> Processing Forum

> [@How To Test for Lost Serial Port?](https://discourse.processing.org/t/how-to-test-for-lost-serial-port/15437/16):
>
> I managed to get it to work. (based on info from previous comments) Here is the code for anyone to refer in future. import processing.serial.\*; Serial myPort; String currentPort; void setup(){ myPort = new Serial(this, Serial.list()[1], 9600); currentPort=Serial.list()[1]; // Save current port } void draw(){ if(serialPortCheck()==true){ println("com port found"); }else{ println("com port lost"); } serialReadData(); } boolean serialPortCheck(){ boolean connected = fals…

---

_[View the full topic](https://discourse.processing.org/t/how-to-check-if-com-port-is-already-being-used-by-another-application/37946)._
