ethernet

How do you get the ethernet address using Java?

ぃ、小莉子 提交于 2019-11-29 10:57:42
问题 I would like to retrieve the ethernet address of the network interface that is used to access a particular website. How can this be done in Java? Solution Note that the accepted solution of getHardwareAddress is only available in Java 6. There does not seem to be a solution for Java 5 aside from executing i(f|p)confing. 回答1: java.net.NetworkInterface.getHardwareAddress (method added in Java 6) It has to be called on the machine you are interested in - the MAC is not transferred across network

How do I get the MAC address of a network card using Delphi?

人盡茶涼 提交于 2019-11-29 07:45:59
As per title - can anyone help me? Get the JEDI conversion of the Microsoft IP Helper Library from the Project JEDI API Header Library - the file is IPHlpAPI.zip. Unpack the files, you need IpTypes.pas and IpHlpApi.pas. Then you can use something like this: procedure TForm1.Button1Click(Sender: TObject); var NumInterfaces: Cardinal; AdapterInfo: array of TIpAdapterInfo; OutBufLen: ULONG; i: integer; begin GetNumberOfInterfaces(NumInterfaces); SetLength(AdapterInfo, NumInterfaces); OutBufLen := NumInterfaces * SizeOf(TIpAdapterInfo); GetAdaptersInfo(@AdapterInfo[0], OutBufLen); Memo1.Lines

How to use the host network, and any other user-defined network together in Docker-Compose?

孤街醉人 提交于 2019-11-29 02:48:46
问题 I want to connect two Docker containers, defined in a Docker-Compose file to each other ( app and db ). And one of them ( app ) should also be connected to the host network. The containers should be connected to a common user-defined network ( appnet or default ) to use the embedded DNS capabilities from docker networking. app needs also to be directly connected to the host network to receive ethernet broadcasts (network layer 2) in the physical network of the docker host. If I use both

Raw Socket promiscuous mode not sniffing what I write

假装没事ソ 提交于 2019-11-29 02:31:09
I am writing a program with a Raw Socket in promiscuous mode and I need the raw socket not sniff the packet I send. I need to read only the data over the ethernet rx wire (not the tx wire). It's posible? Thanks a lot. The solution is to look in the read packet if it is a PACKET_OUTGOING. Using this option you can diference the packet you put in the ethernet tx wire and the packet you read from the rx wire. Open the Socket in promiscuous mode: char* i = "eth0"; int fd; struct ifreq ifr; struct sockaddr_ll interfaceAddr; struct packet_mreq mreq; if ((fd = socket(PF_PACKET,SOCK_RAW,htons(ETH_P

How do I create virtual ethernet devices in linux?

谁说胖子不能爱 提交于 2019-11-28 16:01:08
问题 I am testing an implementation of a protocol that talks between two computers using ethernet (not IP). In order to not actually have to have two physical computers, I want to create two virtual ethernet interfaces. These would only be able to talk to each other, so one endpoint program would bind to one interface and the other endpoint would bind to the other. Is this possible and how do I do it? 回答1: You can use VDE2, a virtual switch. For example (you will need a few terms): # Install vde2

Ethernet Connectivity through Programmatically (Android) (Rooted Device)

主宰稳场 提交于 2019-11-28 05:58:27
I have a small issue regarding Ethernet . My three questions are: Can we programmatically Turn-On/Off Ethernet ? Can we programmatically Enable/Disable Ethernet ? Can we programmatically Connect Ethernet ? The above Questions are done with the Wifi . Like We can programmatically Turn-On/Off Wifi . We can programmatically Enable/Disable Wifi . We can programmatically Connect Wifi using WifiManager . Does android provides any EthernetManager like as WifiManager to handle Ethernet ? Or, if this doesn't seem feasible, then my original requirement is: The first thing I am going to clear is "DEVICE

MAC address from interface on OS X (C)

萝らか妹 提交于 2019-11-28 03:45:39
问题 This might be a stupid question and I apologize if it's already been addressed here, but I've searched quite a bit without much luck. I'm trying to get my interface's hardware address in C and I'm using OS X (x86-64). I know how to get it with ifconfig , but I want my program to get it automatically for any computer, well, at least OS X computers. I found another thread that posted this link which pretty much does what I want (with some modifications), but I can't make the iokit functions

How can I access netstat-like Ethernet statistics from a Windows program

╄→尐↘猪︶ㄣ 提交于 2019-11-27 14:52:07
How can I access Ethernet statistics from C/C++ code like netstat -e ? Interface Statistics Received Sent Bytes 21010071 15425579 Unicast packets 95512 94166 Non-unicast packets 12510 7 Discards 0 0 Errors 0 3 Unknown protocols 0 A good place to start for network statistics would be the GetIpStatistics call in the Windows IPHelper functions. There are a couple of other approaches that are possibly more portable:- SNMP. Requires SNMP to be enabled on the computer, but can obviously be used to retrieve statistics for remote computers also. Pipe the output of 'netstat' into your application, and

How to reliably generate Ethernet frame errors in software?

痞子三分冷 提交于 2019-11-27 14:02:31
Question: I'm testing a section of cable-fault finding software, and I'd like to reliably and reproducibly generate cable faults on a cat5 cable. At the moment I'm using a meter length of untwisted cable, and wriggle the cable manually next to a power supply, but I cannot detect any faults in the application (I'm reading the Ethernet fault counters off the Ethernet ASIC.) Whether this is because no faults are generated, or because the software/hardware detection is faulty, I cannot tell. Is there a way to do this in software? I'd settle for writing something in a higher level language, like

How to specify which eth interface Django test server should listen on?

人盡茶涼 提交于 2019-11-27 03:16:09
问题 As the title says, in a multiple ethernet interfaces with multiple IP environment, the default Django test server is not attached to the network that I can access from my PC. Is there any way to specify the interface which Django test server should use? -- Added -- The network configuration is here. I'm connecting to the machine via 143.248.x.y address from my PC. (My PC is also in 143.248.a.b network.) But I cannot find this address. Normal apache works very well as well as other custom