Remote debugging in Android - adb

I want to debug android app running on a device which is USB-attached to some remote machine [call Server here] in network from my local system/eclipse [say Client].
I think it's achievable using port forwarding.
I tried adb forward command following way:
in Server: adb forward tcp:6037 tcp:5037
in Client: adb forward tcp:5037 tcp:<remote-host>:6037
but when I fire command in Client, I get "error: cannot rebind smartsocket" or in some systems "Internal error."
Any sort of idea what wrong I'm doing?

Related

How send request from react native to local server

I am using android emulator and when i send request to localhost it gives me error. I have tried the forwarding the port also ngrok but none of them worked for me. It always gives me error.
[Error:Network Error].
IN Emulator go to setting->click on Network and Internet ->then select Internet->select available network and then re-run your project and check it will work
Please try http://10.0.2.2:8080 instead of localhost:8080. If you are referring your localhost on your system from the Android emulator then you have to use http://10.0.2.2:8080/ Because Android emulator runs in a Virtual Machine therefore here 127.0.0.1 or localhost will be emulator's own loopback address.
Original Answer Source

Ubuntu 18.04 Apache2.4.29 not able to open ports other than 80

As stated in title, I have LAMP configuration with Apache2.4.29, the problem is when I open a new port other than 80(in this case, port 12743), it could not be accessed through edge browser as port 80 does.
I added a line here under /etc/apache2/ports.conf:
appended a paragraph under /etc/apache2/sites-enabled/000-default.conf
after that I used the following command to restart Apache2:
all these shows no warning nor error messages.
The Ubuntu currently has ufw inactive, and used iptables and fail2ban instead:
however, attempts to access the website via new port failed returning the following page:
I wonder what might be the problem.
Problem solved, what I needed was just a sudo reboot.
It turned out that adding ports shall require not only an Apache2 restart but also a server reboot.

VSCode Remote SSH to Linux - Connecting was canceled

I am trying to connect from my Windows 10 machine to my Ubuntu Linux server (16.04.6) using Remote SSH.
To do this I've read many different tutorials but have no success.
I am able to connect from my Windows 10 command prompt to the Ubuntu Linux server via ssh without any problems. I even used ssh-keygen to generate a private and a public key and copied the public key to the appropriate directory on the Linux Server (.ssh).
In VsCode I installed the extension Remote-SSH added my host to my configuration file c:\user.ssh\config:
Host <ip-address>
HostName <ip-address>
User <username>
Then I clicked in VSCode the button bottom left "Open a remote Window" and chosed my host. A new windows opens and VSCode is trying to connect. Then I see a window with the error message: "Could not establish connection to . Connection was canceled". This is the log.
[11:53:17.573] Log Level: 2
[11:53:17.582] remote-ssh#0.51.0
[11:53:17.583] win32 x64
[11:53:17.586] SSH Resolver called for "ssh-remote+<ip-address>", attempt 1
[11:53:17.587] SSH Resolver called for host: <ip-address>
[11:53:17.587] Setting up SSH remote "<ip-address>"
[11:53:17.648] Using commit id "5763d909d5f12fe19f215cbfdd29a91c0fa9208a" and quality "stable" for server
[11:53:17.650] Install and start server if needed
[11:53:18.624] getPlatformForHost was canceled
[11:53:18.625] Resolver error: Connecting was canceled
[11:53:18.640] ------
Again, I can connect to the same linux server via ssh from my local machine (Win 10) without any problems.
I've resolved the connection issues; possibly the ssh config was not correctly saved/accessed by VS Code?
I thought I should be able to directly set it up to point to an existing config file, but that didn't seem to work. Instead, I created a new config file in the UI, and over-wrote the contents. Shouldn't be necessary, but seemed to do the trick.
What I did was:
Add new host: => Remote-SSH: Connect to host... => Add New SSH Host...
Type in command: ssh user#host to attempt to connect
Choose platform in the command bar in the new window (Linux in my case)
Verify connected (I needed to change ssh-agent settings to store credentials)
Edit the config location: => Remote-SSH: Connect to host... => Settings
Enter config file under Remote.SSH: Config File (C:\Users\me\.vagrant\machines\default\virtualbox\config in my case)
Modify config file further, as needed
Connect through the UI: Remote-SSH: Connect to host... =>
Hope that helps!
For me it was not starting necessary SSH*. See status services using:
Get-Service SSH* on PowerShell.
I got a time out error on enabling necessary services and this helped.
A colleague of mine was with this problem. We solved just deleting his %USERPROFILE\.ssh\config file, closing VSCode, reopening it, and trying to connect again.
There was some garbage in his ssh config file.
I also found that if the value of the "Host" field includes a ")" character, then there will be an error message as follows and the VSCode keeps trying opening remote:
The terminal process "C:\WINDOWS\System32\cmd.exe /c (type "C:\Users\xxxxx_xxxxx\AppData\Local\Temp\vscode-linux-multi-line-command--ccton_---_---2-705401992.sh" | ssh -T -L 127.0.0.1:53080:/run/user/1000/vscode-ssh-remote-server-sock-1636523090 Accton_AWS_EC)2 bash) & exit /b 0" terminated with exit code: 1.
I tried the following that worked for me:
Click on View > Command Palette (alternatively press CTRL + Shift + P)
Start typing:
Remote SSH: Kill
Click on the first option that says: Remote-SSH: kill VS Code Server on Host...
From the options, click on the server you are having trouble connecting to. This will kill that VScode server.
Now just try to reconnect:
a. View > Command Palette (alternatively press CTRL + Shift + P)
b. Start typing:
SSH Remote-SSH: Connect to host...
c. Select the server.
Adding my 2 cents here, I too had lots of trouble connecting to a remote using "Remote SSH Extension of Microsoft". Unfortunately, no luck and spent a lot of time trying all ways possible.
I found another extension named "SSH Client" by cweijan. It was easy and I was able to access my remote using it.
When I had this issue it was because the extension was complaining that the pem file permissions were too open, it should be accessible just by my current user.
Yes, I would like to ~ add on top of Shivam Popat's answer.
Configure F1 ssh.add and Option to add client, and password appears.
Now, connect, and save.
From the left pane you would see icon of key. and upon clicking it will open the remote folders.
The previous problem with VScode remote SSH resolved.

How do you debug react-native when it is running on device?

How do you debug react-native when it is running on device ?
Figured our React Native debugging for Android. Steps to for someone struggling with this -
Launch your RN App
Shake device
Select "Dev Settings"
Select "Debug server host & port for device" Put in your system's IP address.
Shake device
Select "Debug JS remotely"
Chrome will open a new tab with the address "http://localhost:8081/debugger-ui"
If this doesn't happen, check your port and open a new tab and enter the above address with your port number.
Open #Chrome DevTools (Cmd+Alt+I on #MacOSX)
Select the Console Tab
Shake Device
Select "Reload"
View all your console logs or use "debugger;" in your JS for breakpoint debugging.
You have two options:
Debug remotely
iOS: Cmd + ctrl + z to open menu and select "Debug remotely"
Android: Cmd + M to open menu and select "Debug remotely"
Or run one of these commands:
react-native log-ios
react-native log-android
There are little hack in here for IOS.
In XCode open AppDelegate.m from project folder, comment the line with jsCodeLocation declaration and add near it something like this:
jsCodeLocation = [NSURL URLWithString:#"http://%YOUR_PC_IP%:8081/index.ios.bundle?platform=ios&dev=true"];
, where %YOUR_PC_IP% is IP of your dev machine on local net.
Then open project named RCTWebSocket wich located in Libraries folder and then open from this project file RCTWebSocketProjectExecutor.m. Next, comment the line with host declaration, then add near it something like that:
host = #"%YOUR_PC_IP%";
Almost done. Run app on your device with XCode and make sure that your IPhone can see your develop machin via internet.
After it launches make sure that node server is running (command "react-native -- --start" in root project folder) and open via chrome this page: http://localhost:8081/debugger-ui . Plus, option Debug JS Remotely must be enabled in your app on your IPhone. (Shake action, then tap in opened menu Debug JS Remotely, that is it.)
Now open dev console and have happy debugging.
2 options exist:
Remote debug: this would go over network, so it can be laggy.
Run app on device (install it whilst its plugged in)
Shake device (Android devices need to be vigorously shaken)
Press settings on the dev menu, and under Debugging, press Debug server host and port for device
Enter your debug server's IP address and port (usually 8081 unless you changed your settings of the debug server), e.g. 255.255.255.255:8081. Your ip address is the local IP address that your computer has. Ensure the device is on the same network. For mac users, open System Preferences → Network → Wifi → Under Status: connected, there is an IP address, use that.
You can unplug the device
Ensure debug mode is on (Shake device vigorously again, press Debug)
Wired debug: relatively better for slow connections
Install app on phone
If android, set up port forwarding with adb reverse tcp:8081 tcp:8081 and if iOS, follow the steps from RN docs)
Enable debug on device
If you are working on Visual Studio Code then you can install React Native Tools extension (provided by Microsoft) and debug your app like any other IDE.
Read all steps in detail in my this answer.

Open ssl unkown protocol

I wrote a code that worked for me great, I don't remember modifying it..
I compiled it today and tried to run it, but I got this error:
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
I also tried to connect to the host name with the openssl client, but I've got and error says: Linked closed ping timeout..
I also tried to Install openssl again, and even install an older version but it didn't work..
Any solutions?
I also tried to connect to the host name with the openssl client, but I've got and error says: Linked closed..
It sounds like the remote host is not available. If you can't connect to the remote host using command line tools, then there's nothing you can do with your code to make it work. Verify that the remote host is responding correctly first.

Resources