# OpenPort with vin-driver and order of ports

**URL:** <https://forum.commonvisionblox.com/t/openport-with-vin-driver-and-order-of-ports/701>\
**Category:** .Net API\
**Created:** [March 6, 2019, 4:54pm UTC](https://forum.commonvisionblox.com/t/openport-with-vin-driver-and-order-of-ports/701 "2019-03-06T16:54:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laurens](https://avatars.discourse-cdn.com/v4/letter/l/85f322/32.png) [@Laurens](https://forum.commonvisionblox.com/u/Laurens)\
**Post date:** [March 6, 2019, 4:54pm UTC](https://forum.commonvisionblox.com/t/openport-with-vin-driver-and-order-of-ports/701/1 "2019-03-06T16:54:39Z")

</div>

I am trying to communicate with two camera’s using two instances of the same program where I can set the port I want to connect to.

> **TryOpenPort code**
>
> ```
> var scannerPort = int.Parse(ScannerPortTextBox.Text);
> DeviceFactory.TryOpenPort("GenICam.vin", scannerPort, out Device device)
> 
> ```

When I first connect to port 1, then with the second instance to port 0, this works. But when I first connect to port 0, then to port 1 with the second instance it returns false (device=null).

I think there is something I’m overlooking here?

---

<div class="post-metadata">

**Author:** ![rtp\_derahs](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/rtp_derahs/32/79_2.png) [@rtp\_derahs](https://forum.commonvisionblox.com/u/rtp_derahs)\
**Post date:** [April 8, 2019, 1:31pm UTC](https://forum.commonvisionblox.com/t/openport-with-vin-driver-and-order-of-ports/701/2 "2019-04-08T13:31:07Z")

</div>

Hi @Laurens

first of all I want to say sorry for the late response!

When loading the :cvb: vin driver, port 0 gets automatically loaded before it switches to the desired port.  
Since opening a specific port twice isn’t possible (at least if you do it from different processes), it makes sense, that you can’t load the driver, if you already opened port 0 before. To fix this, you need to adjust the GenICam.ini file. It is located at %CVB%Drivers. Simply enable the following flag:

`AutoSwitchEnable=1`

All it does, is letting the driver check if the port, it currently wants to load, is already in use, and if so, it changes to the next port or as in your case: to the desired port.

Alternatively you can use the new :cvb: discovery. You will find a short tutorial on how to use it in this post: [https://forum.commonvisionblox.com/t/exception-during-discovery/318/8?u=rtp\_derahs](https://forum.commonvisionblox.com/t/exception-during-discovery/318/8)

---

<div class="post-metadata">

**Author:** ![Peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@Peter](https://forum.commonvisionblox.com/u/Peter)\
**Post date:** [June 16, 2020, 2:24pm UTC](https://forum.commonvisionblox.com/t/openport-with-vin-driver-and-order-of-ports/701/3 "2020-06-16T14:24:32Z")

</div>

The path is not correct or has changed. I found GenICam.ini in folder “c:\ProgramData\STEMMER IMAGING\Common Vision Blox\Drivers” or %CVBDATA%Drivers or %CVBCONFIG%Drivers.

---

<div class="post-metadata">

**Author:** ![rtp\_derahs](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/rtp_derahs/32/79_2.png) [@rtp\_derahs](https://forum.commonvisionblox.com/u/rtp_derahs)\
**Post date:** [June 16, 2020, 9:04pm UTC](https://forum.commonvisionblox.com/t/openport-with-vin-driver-and-order-of-ports/701/4 "2020-06-16T21:04:18Z")

</div>

Hi @Peter

No, it has always been %CVBDATA%  
Thank you for pointing that out! 🙂

---

<div class="post-metadata">

**Author:** ![illusive](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/illusive/32/61_2.png) [@illusive](https://forum.commonvisionblox.com/u/illusive)\
**Post date:** [June 19, 2020, 9:22pm UTC](https://forum.commonvisionblox.com/t/openport-with-vin-driver-and-order-of-ports/701/5 "2020-06-19T21:22:48Z")

</div>

weeeeeeellll…

that is my chance to nit-pick 😜  
In fact the file used to be located in `%CVB%\Drivers` up until Windows XP. With Windows Vista File System Virtualization and UAC on `C:\Program Files` kicked in and it no longer was a good idea to store the configuration there, so we found a new spot for it in the location `C:\ProgramData\STEMMER IMAGING\Common Vision Blox` and to make it less fussy added `%CVBDATA%`. This was introduced in CVB 10.00.000 which was the first version to actually run properly on Windows Vista. However, 10.x and later still used to install the file to `%CVB%\Drivers` when installed on a Windows XP machine…
