Hello, I am trying to open a device over serial port using windows bluetooth api's. Following is the code snippet : BluetoothFindFirstRadio(&m_bt_find_radio,&m_radio); . . . BluetoothAuthenticateDevice( NULL, m_radio, &m_device_info, L"PASSKEY", SEVEN ); . . //m_device_info.Address contains the bluetooth address in the format "AA:BB:CC:DD:EE:FF" . . BluetoothSetServiceState( NULL, &m_device_info, &SerialPortServiceClass_UUID, BLUETOOTH_SERVICE_ENABLE ); If authentication fails then tried retry for 3 times. . . /* Logic has been implemented to find the com port created by BluetoothSetServiceState(. .. ) api. * / . . CreateFileA ( (LPCSTR)szComPortStr, GENERIC_READ | GENERIC_WRITE, NULL, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL ); szComPortStr is having the format : " \\\\.\\%s" where %s specifies the port number. If CreateFileA() fails then tried retry for 3 times. The CreateFileA() api fails for several times and works sometimes with same implementation. Thus the api shows unexpected behavior, resulting into application performance issue.