Debug an app using TCP - c++

I am a total newbie and trying to debug an application which should receive a binary via TCP. When I launch it, it begins to listen several ports, I execute cat myfile | nc port_number in another terminal (apps terminal is busy) and the app runs. But I have no idea how to debug it in Qt creator. Everything I found on the Internet seems irrelevant to my problem.

Related

With django, how to control the server's stop and start again by batch.bat via a button on the screen, use the Windows operating system

With django, how to control the server's stop and start again by batch.bat via a button on the screen, use the Windows operating system
all the methods I got The process is done manually and I didn't find an automated way or code that works on it
for example:
1-I have to Open Windows PowerShell as Administrator
Find PID (ProcessID) for port 8080:
netstat -aon | findstr 8000
TCP 0.0.0.0:8080 0.0.0.0:0 LISTEN 77777
Kill the zombie process:
taskkill /f /pid 77777
Now we return to the question
how can I do this process automatically, either through the batch.bat file or through the django code

Could not connect to TCP port: Connection refused when trying to open Expo app on Android Emulator in WSL2

I've been following this guide https://medium.com/#pellea/using-adb-with-wsl2-7aebbb070a47 and so far have gotten to the point where WSL2 can see the emulator(s) running on Windows through Android Studios -> AVD manager. For example, on both Windows and WSL2, adb devices correctly shows:
List of devices attached
emulator-5554 device
However, when I go to my expo app and try to launch the Android emulator, I get the following error message:
Couldn't start project on Android: could not connect to TCP port 5554: Connection refused
This is after I've tried the following:
exporting ADB_SERVER_SOCKET=tcp:<MY IP>:5037 in my WSL2 profile(s)
Unblocking WSL2 vEthernet connections from my Windows firewall via (from the above link)
Set-NetFirewallProfile -DisabledInterfaceAliases "vEthernet (WSL)"
I've portforwarded 5554 from Windows to WSL2, as well as 5037 (from 0.0.0.0 to 127.0.0.1):
$WSL_CLIENT = bash.exe -c "ip addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'";
$WSL_CLIENT -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
$WSL_CLIENT = $matches[0];
iex "netsh interface portproxy add v4tov4 listenport=5554 listenaddress=127.0.0.1 connectport=5554 connectaddress=$WSL_CLIENT"
The ports are as follows:
netsh interface portproxy show all
Listen on ipv4: Connect to ipv4:
Address Port Address Port
--------------- ---------- --------------- ----------
127.0.0.1 8081 172.25.38.171 8081
0.0.0.0 5037 127.0.0.1 5037
127.0.0.1 5554 172.29.149.0 5554
Just had the same issue with Expo.
Here is what fixed it for me:
Check for a process that uses port 5555 (Terminal)
netstat -ano | findstr 5555
Kill the process using its ID (PowerShell)
Stop-Process -ID [PROCESS_ID] -Force
Then it started working.
I had the exact same problem, but with a different setup (using Expo with the Metro bundler on a Mac). I worked around it by trying different virtual device images. Maybe the same can help you.
The virtual device that works with me so far is the one selected in this screenshot: https://i.stack.imgur.com/CFTJ0.png. The other two in the screenshot have the same problem. I don't really know the actual reason, must be something with port access with those other emulated devices.
Image details:
Name: 4 WVGA (Nexus S) API 29
API: 29
Target: Android 10.0 (Google APIs)
CPU/ABI (x86)
I'm sure other images work as well (or configuring the others somehow), i just haven't tried many more because it takes so long and they're so big.
Did you try to map port 5554 to Windows IP instead? (or localhost). The Android emulator is running on Windows, not WSL2, so the port proxy should be from WSL2 to Windows, not backwards.
Have you already solved it in another manner?

Couldn't connect web socket client to websocket server on local host windows 10

I have an application signed for microsoft store which starts a web socket server on localhost (0.0.0.0:8081) on launching. Then I run python script with websocket client on the same host and try to connect to server (ws://127.0.0.1:8081) and it couldn't connect. But I can connect without any problems if I run this python script from another PC. Actually it works fine on local PC on another platforms: Win7, MacOS.
What i tried:
disabled windows firewall and defender
tried to add exception for application using CheckNetIsolation LoopbackExempt
tried to connect using different ip (0.0.0.0, 127.0.0.1, pc name)
It seems like I have to switch/set on/off some option for application or win10, but I can't find it
Thanks for help in advance
I found a solution https://learn.microsoft.com/en-us/windows/iot-core/develop-your-app/loopback
if you want to connect smth to win application on win 10 you should run
CheckNetIsolation.exe LoopbackExempt -is -n=your application
permanently
the best way to add it to start up menu

Wamp server can't bind to port 80 error

I'm having a very similar error to Getting an error when starting WAMP - "VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results"
I'm getting the same
Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80"
error message in the event logs viewer. I tried the fix of disabling skype from using port 80 however when I do that nothing comes up in the console. I am using 64 bit wamp, im in a 64 bit windows 8.1 laptop.
Edit: Problem resolved, changed Listening on 80 to 8080 in httpd.cfg
There is a menu item on the WAMPManager icon ( the one in the system tray ) called Test Port 80
You get to it by
wampmanager -> Apache -> Service -> Test Port 80
This will load a command window and show you the name of the other application that has captured port 80.
Then you have to work out what to do about it of course.
Also as far as I am aware the Windows 8 tiled version of SKYPE does not have any way of being configured to stop using port 80. But if you uninstall the Tile version of SKYPE and install the normal Windows version, that allows you to configure it so it will not attempt to use port 80 or 443.
If you really cannot find the wampmanager icon try this instead
Try this
netstat -anop TCP | find ":80"
tasklist /FI "PID eq 999" /FO TABLE /NH
replacing 999 with the PID number from the previous command that is using port 80.
Other programs can mess with this.
Are you using Skype by chance or any other program.
If you are just turn it off and then launch wamp and then launch your program.
Open Command Prompt and run netstat -ano | findstr :80
That will list all connections and their process ID (on the right) that are using port 80. Match them with process IDs in your task manager and close them.

Using Eclipse to remotely debug with gdbserver

Does anyone know why I can't use Eclipse CDT to remotely debug a device when I manage it on the command-line with gdb using target remote command? I do get a warning when connecting, but other than that it seems to work fine.
With Eclipse I should have the correct settings and gdbserver informs me on the remote machine that a connection was establised but after that Eclipse gives an error: 'Launching Debug' has encountered a problem. The request failed: Target is not responding (timed out). Remote device also says "Killing inferior" (which I don't get with gdb). The error log shows nothing else either.
I am using the same process, binary and gdb executable in both cases and connecting to the same device & port. I'm using gdb 7.1 and the host is 64-bit Ubuntu Lucid.
I had same issue and found that iptables was generating issues.
Have you tried stopping or disabling your firewall? In case of iptables you have to do:
/etc/init.d/iptables stop
On the other hand, after you start your application (before connecting your debugger) have you checked the debug port availability through netstat?
#On linux
netstat -nap
#On windows
netstat -nab
Hope to help.