network-interface

Android NetworkInterface. What are the meanings of names of NetworkInterface?

扶醉桌前 提交于 2019-12-02 21:07:54
I want to get available network of the current device, so I firstly get networkinterfaces list: NetworkInterface.getNetworkInterfaces(); Then, iterate every one: NetworkInterface intf = en.nextElement(); String name = intf.getName(); Here is the problem. The names of returned value of 'name' are: rmnet_data1, dymmy0, wlan0, rmnet_usb0, intf, lo, p2p0, sit0. (on my device) I want to know what are the meanings of them. jeyoor Since Android is based on Linux, Linux network interface naming patterns apply to Android devices. Here's some resources on *nix network interface naming a tour of classic

Send data through wifi (no internet) when mobile data on

感情迁移 提交于 2019-12-02 18:53:34
I'm developing and application that connects to a hardware device through wifi (generated by the device) and send data to it through a socket connection. The problem is that when mobile data (3G/4G) is activated android tries to send the data through it instead of sending it through the wifi generated by the device, because because the wifi has no internet connection. I was thinking of using ConnectivityManager#setNetworkPreference() but it has been deprecated in api 21. How can I set it to send data using the wifi generated by the device instead of the mobile data interface? hygorxaraujo

Get network interface name from IPv4 address

跟風遠走 提交于 2019-11-30 18:29:19
问题 Given an IPv4 address, how can I obtain its associated network interface name, like "Ethernet adapter Local Area Connection", in Windows using C++? Alternately, how can I obtain a list of both network interface names and IPv4 addresses for the local computer? I'm able to get only the IPv4 addresses using getaddrinfo and inet_ntoa . 回答1: #include <windows.h> #include <iphlpapi.h> #include <stdio.h> #pragma comment(lib, "iphlpapi.lib") int main(int argc, char** argv) { PIP_ADAPTER_INFO

issue in deleting VPC and network interface

蹲街弑〆低调 提交于 2019-11-30 06:00:57
I am trying to delete aws vpc (a non default one). I am getting error that "We could not delete the following VPC (vpc-xxxxxxx (xx.xx.xx.x/16)) Network interface 'eni-xxxxxx' is currently in use. (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterValue; Request ID: xxxxxx-dd86-47c8-98cd-xxxxxxxxxxx)". When I tried deleting the related Network Interface, I got error "eni-xxxxxxx: You do not have permission to access the specified resource." There are security groups associated with the NI (network interface). There are subnets associated with the NI. There are no EC2 instances -

issue in deleting VPC and network interface

一曲冷凌霜 提交于 2019-11-29 05:25:10
问题 I am trying to delete aws vpc (a non default one). I am getting error that "We could not delete the following VPC (vpc-xxxxxxx (xx.xx.xx.x/16)) Network interface 'eni-xxxxxx' is currently in use. (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterValue; Request ID: xxxxxx-dd86-47c8-98cd-xxxxxxxxxxx)". When I tried deleting the related Network Interface, I got error "eni-xxxxxxx: You do not have permission to access the specified resource." There are security groups associated

How to specify a network interface when making net requests from Node.js?

烈酒焚心 提交于 2019-11-29 02:13:08
In either http.request or net.connect , is there an option that I can specify a network interface to initiate a connection? EDIT: AFAIK in OS level I can specify address level, or load balancing into routing tables. But the way of interface choosing in my software is more than that, I wanna know if I can do that in codes. Node has this built in: http://nodejs.org/api/net.html#net_net_connect_options_connectionlistener http://nodejs.org/api/http.html#http_http_request_options_callback See localAddress , just set that to the IP of the interface you'd like to use. EDIT : As mak pointed out, it is

What exactly means iOS networking interface name? what's pdp_ip ? what's ap?

落爺英雄遲暮 提交于 2019-11-28 12:02:27
I use following code to print all interface and it's mac address - ( void )interfaceInfo{ int mib[6]; size_t len; char *buf; unsigned char *ptr; struct if_msghdr *ifm; struct sockaddr_dl *sdl; mib[0] = CTL_NET; mib[1] = AF_ROUTE; mib[2] = 0; mib[3] = AF_LINK; mib[4] = NET_RT_IFLIST; char name[128]; memset(name, 0, sizeof(name)); for (int i=1; i<20; i ++) { if (if_indextoname(i, name)) { printf("%s ",name); }else{ continue; } if ((mib[5] = if_nametoindex(name)) == 0) { printf("Error: if_nametoindex error\n"); return NULL; } if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0) { printf("Error: sysctl,

Can't connect to cassandra node from different host

你。 提交于 2019-11-27 20:41:05
I have a cassandra node at a machine. When I access cqlsh from the same machne it works properly. But when I tried to connect to it's cqlsh using "192.x.x.x" from another machine, I'm getting an error saying Connection error: ('Unable to connect to any servers', {'192.x.x.x': error(111, "Tried connecting to [('192.x.x.x', 9042)]. Last error: Connection refused")}) What is the reason for this? How can I fix it? Nicola Ferraro Probably the remote Cassandra node is not bound to the external network interface but to the loopback one (this is the default configuration). You can ensure this by using

How to Determine Internet Network Interface in Java

爷,独闯天下 提交于 2019-11-27 20:15:15
How do you determine which network interface is connected to the internet using Java? For example, I run InetAddress.getLocalHost().getHostAddress(); and within Eclipse this returns exactly what I intend, 192.168.1.105. However, if I package this into a jar file and run the program, the code returns 169.254.234.50. Looking into this, I found this is the IP address of a VMware Virtual Ethernet Adapter interface on my machine. Is there any way to determine the interface connected to the internet, yet at the same time maintain portability for my code? Comparison of Interfaces Interface [net4]

Python: check whether a network interface is up

蹲街弑〆低调 提交于 2019-11-27 14:50:14
In Python, is there a way to detect whether a given network interface is up ? In my script, the user specifies a network interface, but I would like to make sure that the interface is up and has been assigned an IP address, before doing anything else. I'm on Linux and I am root . As suggested by @Gabriel Samfira, I used netifaces . The following function returns True when an IP address is associated to a given interface. def is_interface_up(interface): addr = netifaces.ifaddresses(interface) return netifaces.AF_INET in addr The documentation is here The interface can be configured with an IP