ipv6 and TidHTTP issue on Android & iOS - android

we are trying to connect to an ipv6 local server address. This is the code snippet
_st := IdHTTP1.Get('http://[fe80::a6ee:57ff:fe5c:7de6]:8000/reparti');
The issue is the following:
If we compile for Windows -> It works and we get the json response
if we compile for either Android or iOS -> we get
"socket error #22 invalid argument"
and no response and the server do not receive any request
What are we missing?
Thank you for the support

The IP address you are attempting to connect to is incomplete. It is missing the mandatory scope ID.

Related

Flutter websocket Error. Connection to 'http:...#' was not upgraded to websocket

I'm getting this error when trying to connect to the server I opened locally.
It converts ws to http. and put a # sign at the end.
Socket:
final channel = IOWebSocketChannel.connect(Uri.parse('ws://192.168.1.226:10600'));
**Error: **
Restarted application in 1.052ms. D/EGL_emulation(14743): app_time_stats: avg=8757.14ms min=3.84ms max=218720.27ms count=25 E/flutter (14743): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: WebSocketException: Connection to 'http://192.168.1.226:10600#' was not upgraded to websocket
The server was created with .net 4.8.
I would be glad if you help
I want to show the messages sent by the server in the application.

Http failure response for xxx 0 Unknown Error

PostGraphile v4.9.2 server listening on port 5001
‣ GraphQL API: http://0.0.0.0:5001/graphql
how can i change http to https. i mean, i want https://0.0.0.0:5001/graphql
because, i am getting error while debugging my ionic capacitor app for android
E/Capacitor/Console: File: http://localhost/vendor-es2018.js - Line 41539 -
Msg: ERROR Error: Http failure response for http:// mydomain .com:5001/graphql: 0 Unknown Error
i think it is about http problem but as you see it is unknown error. Thanks in advance
i found the solution here: How to allow all Network connection types HTTP and HTTPS in Android (9) Pie?
i allowed http requests in manifest.xml and i added networkSecurityConfig.xml
Thank you all

How to resolve Ipv4 and Ipv6 from ".local" using mDNS in Android

I am trying to resolve IPv4 and IpV6 from ".local" using multicast DNS and I tried https://github.com/posicks/mdnsjava but it unable to resolve required ipv4/ipv6. Alternatively, I found one app which work for me but have no idea how it works.
App Link : https://play.google.com/store/apps/details?id=com.dokoden.dotlocalfinder
Also I am trying to resolve ".local" using Linux Terminal -
Command used to resolve ipv4
avahi-resolve-host-name abc.local -4
Command used to resolve ipv6
avahi-resolve-host-name abc.local -6
and it resolved successfully.
I am tried same command in Android to resolve ".local" but getting Cannot run program "avahi-resolve-host-name": error=13, Permission denied
I am trying this piece of code in Android -
Process process = Runtime.getRuntime().exec("avahi-resolve-host-name abc.local -4");
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
Log.d("OutPut",in.readLine());
Finally, I got success.
I resolved Ipv4 and Ipv6 using mdnsjava dependency i.e.
implementation "xyz.gianlu.mdnsjava:mdnsjava:2.2.1"
For resolving Ipv4 I use this code snippet
for (Record record : new Lookup(localName, Type.A, DClass.IN).lookupRecords()) {
if (record.getType() == Type.A) {
((ARecord) record).getAddress().getHostAddress();
}
}
Before writing this code snippet you have to put MuticastLock on connected Wifi using
WifiManager.MulticastLock multicastLoc = wifiManager.createMulticastLock("mDnsLock");
multicastLoc.setReferenceCounted(true);
multicastLoc.acquire();
and after getting ip release multicastLock.
For Ipv6 I used same Ipv4 code snippet only here the record type should be Type.AAAA in place of Type.A
This code works up to Android 10.
I am not 100% this will work, but as comment is was to large.
check the following permissions in your AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Following links might be usefull:
How to get IP address and names of all devices in local network on Android
https://developer.android.com/guide/topics/connectivity/wifi-scan
https://github.com/stealthcopter/AndroidNetworkTools

Problem posting data from my app to local api using nativescript angular 6 on a device

When I post data from my native script angular app which will be running on my android device to my local API which is using dotnet core API. I get an error Error: java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 59521): connect failed: ECONNREFUSED. I can hit my API using postman.
I change from using the Httpclient module to HTTP common, with no luck and I have added android:usesCleartextTraffic="true" to the android manifest.
login(user: User) {
return this.http.post(
BackendService.baseUrl + "user/login",
JSON.stringify({
username: user.email,
password: user.password
}),
{ headers: this.getCommonHeaders() }
)
.pipe(
tap((data: any) => {
BackendService.token = data._kmd.authtoken;
}),
catchError(this.handleErrors)
);
}
I expect to get an success but I get
Error: java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 59521): connect failed: ECONNREFUSED.
In order to connect your Android Emulator (or USB-connected Android device) to your dev server, you need to supply the IP-address of the server, since localhost will not point to it from your Emulator/Device.
Today I found out you have to use 10.0.2.2 as your endpoint in order to reach the localhost from the emulator.
Question asked about running on the device, yes. But people land here for other keywords too.

Git repo sync - connection lost

I'm trying to download android source (Cyanogenmod). i have spent more than 12hrs to download 2.5GB files, Now my connection lost for a while, it shows
error: RPC failed; result=56, HTTP code = 200
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
fatal: unable to access 'https://android.googlesource.com/platform/prebuilts/misc/': Could not resolve host: android.googlesource.com
fatal: unable to access 'https://github.com/CyanogenMod/android_packages_inputmethods_LatinIME/': Could not resolve host: github.com
fatal: unable to access 'https://android.googlesource.com/platform/prebuilts/misc/': Could not resolve host: android.googlesource.com
error: Cannot fetch CyanogenMod/android_packages_inputmethods_LatinIME
error: Cannot fetch platform/prebuilts/misc
error: Exited sync due to fetch errors
Can i resume the download or i should download from the beginning, please help me to resume my download.
Thank you!
Once you have applied the fix that I describe below, you should simply re-run repo sync in order to resume and fully complete the resource synchronization process that was interrupted by these fatal errors.
The solution to the DNS-related error that you've encountered [fatal: Could not resolve host] is detailed on the Known Issues resolution page at Google's AOSP Developer Site. Apply this fix by adding the appropriate host entry for your remote repository android.googlesource.com inside your development machine's /etc/hosts config file. Begin by clicking here and here to execute the IP address lookup tool provided by the free web resource: http://network-tools.com/nslook/.
Google's full description of this issue with detailed resolution I've included here:
Difficulties syncing the source tree (DNS issues).
Symptom: When running repo sync, the process fails with various errors
related to not recognizing the hostname. One such error is
<urlopen error [Errno -2] Name or service not known>.
EDIT: Another fatal error might be Could not resolve host.
Cause: Some DNS systems have a hard time coping with the high number
of queries involved in syncing the source tree (there can be several
hundred requests in a worst-case scenario).
Fix: Manually resolve the relevant hostnames, and hard-code those
results locally.
You can resolve them with the nslookup command, which will give you
one numerical IP address for each of those (typically in the "Address"
part of the output).
$ nslookup googlesource.com
$ nslookup android.googlesource.com
You can then hard-code them locally by editing /etc/hosts, and adding two
lines in that file, of the form:
aaa.bbb.ccc.ddd googlesource.com
eee.fff.ggg.hhh android.googlesource.com
Note that this will only work as long as the
servers' addresses don't change, and if they do and you can't connect
you'll have to resolve those hostnames again and edit etc/hosts
accordingly.
You don't resume a clone, you can try a shallow clone instead.
As mentioned here:
Error code 56 indicates a curl receive error of CURLE_RECV_ERROR which means there was some issue that prevented the data from being received during the clone process.
Typically this is caused by a network setting, firewall, VPN client, or anti-virus that is terminating the connection before all data has been transferred.
You can know more with:
set GIT_TRACE_PACKET=1
set GIT_TRACE=1
set GIT_CURL_VERBOSE=1
You can try changing http.postBuffer or switching to ssh url clone.
Spartan i checked the Cyanogenmod its working normally i prefer use internet download manager.i download 60mp and recall it.successfully fetched and resumed.
Could not resolve host: android.googlesource.com
Which could be a DNS server problem. Try first restarting your modem in order to flush its DNS cache. If you're still seeing the problem, try changing your Primary DNS to either one these two publicized DNS servers that Google operates:
8.8.8.8
8.8.4.4
Note that, if your Primary DNS has already been configured as described and you've also long-rebooted the router without resolution (pun intended), then adjusting your Primary DNS configuration to point at other public DNS servers is not likely to fix your situation. However, a reputable list of no-cost public servers can be found here.

Categories

Resources