scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

No connection could be made because the target machine actively refused it. (10061)

Open codeagencybe opened this issue 4 years ago • 23 comments

Environment

  • OS: Windows 10 pro
  • scrcpy version: 1.12.1
  • installation method: Windows release
  • device model: Samsung Galaxy S8 plus
  • Android version: 9

Describe the bug cannot connect to 192.168.0.116:5555: No connection could be made because the target machine actively refused it. (10061)

Any idea why and how to fix this? I'm just using a stock Samsung phone with Android. Nothing else happened with this device for years. But I can't connect to it.

Yes, both devices are in the same wireless network

codeagencybe avatar Apr 25 '20 13:04 codeagencybe

Did you adb tcpip 5555?

Check https://stackoverflow.com/questions/37267335/android-studio-wireless-adb-error-10061/41422712

rom1v avatar Apr 25 '20 14:04 rom1v

Yes I did that but then it says it could not find any devices or emulators But meantime I have rebooted my entire device and start again and weird enough that error is gone.

But now nothing is showing on my computer. The command seems to be working/running but I'm not sure what is expected after that.

This is all I get:

image

codeagencybe avatar Apr 25 '20 14:04 codeagencybe

Does it work over usb?

rom1v avatar Apr 25 '20 14:04 rom1v

It's the same when trying over USB. It just freezes the command line after I run any of the adb or scrcpy commands.

What should happen after this? Does it open some popup? Do I need to use some other software to see something? It's not documented anything process happens after you run any of those commands so I can't judge or troubleshoot properly if the outcome is correct or not.

codeagencybe avatar Apr 25 '20 14:04 codeagencybe

It should immediately open a window showing your Android device.

Check the output of adb logcat (in a separate terminal) when you start scrcpy.

rom1v avatar Apr 25 '20 14:04 rom1v

nothing happens. Even that log command just freezes. I alrready tried adb disconnect, kill server etc... they all freeze the command line

codeagencybe avatar Apr 25 '20 14:04 codeagencybe

Oh ok you must solve that adb issue then.

adb disconnect
adb kill-server

Reboot your device and try again over USB...

rom1v avatar Apr 25 '20 14:04 rom1v

ok I'll give that a try later today and report back if it worked

codeagencybe avatar Apr 25 '20 14:04 codeagencybe

Hi i have this issue as well. Connection with cable works fine but not for the wireless. I did adb tcpip 5555 then connecting it with adb connect myip:5555 and disconnect the device. When i start the scrpcy it doesnt detect my device, then i opened up the cmd to check if the connection is still establish it didnt. Please help :)

ghost avatar Jun 16 '20 12:06 ghost

Hi,

My phone is able to connect via scrcpy over usb cable on a Windows 10 machine and also on wi-fi when I run the initial commands:

adb.exe tcpip 5555 adb.exe connect 192.168.1.147:5555

However after I reboot or shutdown the computer I'm unable to connect back to my phone without plugging in the usb cable and running the above commands again - which is a bit of a pain.

Is this by design?

I've added screenshot of what I get when the phone is connected.

Thank you.

Capture

r4zi3lrrr avatar Jun 23 '20 10:06 r4zi3lrrr

Is this by design?

It's how adb works. However, if you just reboot your computer (not your device), you should be able to adb connect without plugging USB again.

rom1v avatar Jun 23 '20 10:06 rom1v

Nope still don't work. Even tried rooting my phone - same thing unfortunately.

r4zi3lrrr avatar Jun 24 '20 20:06 r4zi3lrrr

After also struggling thru the same phone/pc/controller connection problem as above, I was finally able to make the connection work & successfully build & run an Android app (DJI "sample_code" from GitHub). The steps listed below worked for me.

  1. make sure phone & PC are using the same wifi network. Use MS "Your Phone" app on the Win10 PC to connect the two.
  2. connect phone to PC via USB
  3. open a CMD window & navigate to C:\Users\yourname\AppData\Local\Android\Sdk\platform-tools> & run the commands: adb connect "phone IP", then adb devices, to confirm phone connection
  4. disconnect phone from USB. Use adb devices command again to make sure phone & PC are still connected. They should be.
  5. connect DJI RC to PC via USB, connect phone to RC via built in USB cable. Turn on RC.
  6. open Android Studio. Once open you should see the model # of your phone in the devices panel in upper right corner of work area. For me I see SM-N960U (Samsung Note 9 running Android 10)
  7. I downloaded opened the DJI-SDK / Mobile SDK Android / Sample Code zip file from GitHub & opened it in Android Studio
  8. Go to DJI Developer site & create a new app (register if you're not already a developer member), naming the app "DJI SDK Sample" & Bundle Identifier is com.dji.sdk.sample (noted as the "package" variable in the AndroidManifest.xml file that you have to edit for the Sample Code app. Submit the app key request & within a minute or so DJI will send you a link to the updated app info in your developer app page. Copy the app key & paste it into the <meta-data ... "com.dji.sdk.API_KEY"> section of the xml file. There's a comment in the code that tells you this.
  9. Click on the green "Run app" arrow. Once the DJI SDK Sample app is built & loaded onto your phone it will open. The app automatically registers the app key w/ DJI. If the app gives you an error msg it's probably because you made some error w/ entering the app info when you created the app & requested the key. If the registration is good then enter the phone IP into the WSBridge line on the app start page as well. Turn on your drone. Once the RC/phone/drone are talking to each other the "Open" button on the app will be come active.
  10. The sample app doesn't do much other than allow you to play w/ some of the drone functionality. It's best use is really as a template/starting point for your particular mission needs as well as a "relatively" simple way to work thru this hardware interface process. So, good luck & I hope that the above comes in useful for other members out there.

pmavery avatar Feb 05 '21 21:02 pmavery

  1. First connect your device trough USB
  2. Run ADB:📱 Disconnect from any devices
  3. And run ADB:📱 Reset connected devices port to :5555
  4. And Then ADB:📱 Connect to device IP enter your device (settings > status > ip address) IP address and be fine

ghost avatar Jan 14 '22 03:01 ghost

Check USB debugging is still enabled. If not, enable and try to connect via adb connect 192.x.x.x:5555. You might see a permissions box pop up on the device to accept and the connect will fail. Accept the permissions and try the command again.

kstevensonmsft avatar Jan 26 '22 20:01 kstevensonmsft

i'm getting this too. but my issue is a bit different. i'll plug it in usb and then unplug it, and it'll connect through tcp fine for a few hours it seems like

then after, i'll get No connection could be made because the target machine actively refused it

girng avatar Feb 19 '23 03:02 girng

Hi,

My phone is able to connect via scrcpy over usb cable on a Windows 10 machine and also on wi-fi when I run the initial commands:

adb.exe tcpip 5555 adb.exe connect 192.168.1.147:5555

However after I reboot or shutdown the computer I'm unable to connect back to my phone without plugging in the usb cable and running the above commands again - which is a bit of a pain.

Is this by design?

I've added screenshot of what I get when the phone is connected.

Thank you.

Capture

I'm having the same issue. After computer OR phone restart , the commend

scrcpy --tcpip=10.0.0.234:5555"

stops working.

cannot connect to 10.0.0.234:5555: No connection could be made because the target machine actively refused it. (10061) ERROR: Could not connect to 10.0.0.234:5555 ERROR: Server connection failed

So to troubleshoot, I have to go bring the usb cable, connect it, run "scrcpy --tcpip" , wait for tcp/ip mode to be enabled, and then disconnect the cable if i so choose. By that time, I already have the cable on hand obviously, so I switch to "scrcpy -d" for a faster connection . How can I make the "tcp/ip" connection persistent? It seems to stops working after a day or so.

I'm using a non-rooted android 9 device

guyviner avatar Sep 25 '23 18:09 guyviner

Hi, I have access my Samsung mobiles screen on my Laptop scrcpy but when i am trying to connect NOKIA phone i got error. i did on NOKIA phone : USB Debugging in Developer mode then adb tcpip 5555 "restarting in TCP mode port: 5555" next i go further adb connect 192.168.10.7:5555 it says "cannot connect to 192.168.10.7:5555: No connection could be made because the target machine actively refused it. (10061)" i got this error only on my Nokia phone device on Samsung devices it work all fine please help me out to get resolve this error on my NOKIA phone i despirately need to Screen Copy on my NOKIA phone

Thanks in advance Sulaman Asif

slemonslim avatar Sep 27 '23 01:09 slemonslim

Is the device on the same network as the computer?

Without AP isolation? https://www.reddit.com/r/scrcpy/comments/16pxn29/i_can_use_my_device_wired_but_cant_seem_to_use_on/

rom1v avatar Sep 27 '23 06:09 rom1v

Is the device on the same network as the computer?

Without AP isolation? https://www.reddit.com/r/scrcpy/comments/16pxn29/i_can_use_my_device_wired_but_cant_seem_to_use_on/

Hi, yes my devices are on same network as the computer as i said other SAMSUNG device connect easily but my NOKIA phone give an error

slemonslim avatar Sep 27 '23 15:09 slemonslim

scrcpy 2.3.1 https://github.com/Genymobile/scrcpy INFO: Connecting to 192.xxx.xxx.x :5555... cannot connect to 192.xxx.xxx.x :5555: No connection could be made because the target machine actively refused it. (10061) ERROR: Could not connect to 192.xxx.xxx.x :5555 ERROR: Server connection failed

can connect thru usb connects then type scrcpy --tcpip=192.xxx.xxx.x connects thru

A:\scrcpy-win64-v2.3.1\scrcpy-server: 1 file pushed, 0 skipped. 6.0 MB/s (66007 bytes in 0.010s) [server] INFO: Device: [HUAWEI] HUAWEI CLT-L29 (Android 10) [server] WARN: Audio disabled: it is not supported before Android 11 INFO: Renderer: direct3d WARN: Demuxer 'audio': stream explicitly disabled by the device INFO: Texture: 1080x2240

disconnects usb it disconnects

DeathShoujo avatar Dec 18 '23 21:12 DeathShoujo

  1. First connect your device trough USB
  2. Run ADB:📱 Disconnect from any devices
  3. And run ADB:📱 Reset connected devices port to :5555
  4. And Then ADB:📱 Connect to device IP enter your device (settings > status > ip address) IP address and be fine

Thanks, it worked.

otnemio avatar Feb 02 '24 16:02 otnemio

Find a solution here that perfectly solves the problem for me. No need to reboot or disconnect. You may have missed some settings like me.

  • turn on : Allow ADB debugging in charge-only mode
  • turn off : Always prompt when connecting to USB

https://stackoverflow.com/questions/60791195/adb-over-tcp-ip-not-working-without-usb-cable-connected

I'm also testing on a Honor phone. I found a solution to solve this problem. You can try to turn on Allow ADB debugging in charge only mode and turn off Always prompt when connecting to USB. It should fix the problem.

Here is the reference for the solution.

lzmfor avatar Feb 17 '24 11:02 lzmfor