# Why is my ConnectionStatus works but the Connect and Disconnect not?

**URL:** <https://forums.digi.com/t/why-is-my-connectionstatus-works-but-the-connect-and-disconnect-not/22936>\
**Category:** Edgeport\
**Tags:** c, anywhereusb14, dll, awusbapi, api\
**Created:** [February 3, 2022, 9:44am UTC](https://forums.digi.com/t/why-is-my-connectionstatus-works-but-the-connect-and-disconnect-not/22936 "2022-02-03T09:44:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tamadi](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@tamadi](https://forums.digi.com/u/tamadi)\
**Post date:** [February 3, 2022, 9:44am UTC](https://forums.digi.com/t/why-is-my-connectionstatus-works-but-the-connect-and-disconnect-not/22936/1 "2022-02-03T09:44:23Z")

</div>

Greatings! I have a problem with using the AwUsbApi. I tried to create a c# windows form app where i can control the AnywhereUsb/14. I use the v3.99.350 dll provided by the driver. I was able to use the ConnectionStatus function, which works perfectly, but the Connect and Disconnect doesn’t. I implemented all three the same way. Could you help me what is the problem with my solution? I attach my relevant part of my code. First the three DLL function import, after that the three call. Thank you for the help!

```
    [DllImport("AwUsbApi.dll", SetLastError = true, CharSet = CharSet.Unicode)]
    private static extern AWUSB_STATUS AwUsbConnect(string hub, out uint status, int timeout, IntPtr handler);

    [DllImport("AwUsbApi.dll", CharSet = CharSet.Unicode)]
    private static extern AWUSB_STATUS AwUsbDisconnect(string hub);

    [DllImport("AwUsbApi.dll", CharSet = CharSet.Unicode)]
    private static extern AWUSB_STATUS AwUsbGetConnectionStatus(string hub, out int ipAddress, out int status, int timeout, IntPtr handler);

```

var c\_return = AwUsbConnect(IP, out uint result, 10000, IntPtr.Zero);  
var dc\_return = AwUsbDisconnect(IP);  
var cs\_return = AwUsbGetConnectionStatus(IP, out int ipadress, out int status, 10000,  
IntPtr.Zero);
