ethernet

Assign static IP to ethernet card from OTG

流过昼夜 提交于 2019-12-04 10:56:14
I would like to assign a static IP to an ethernet card, connected to the Android device via OTG cable. It should be done programmatically, but I can't find any reference regarding ethernet cards in android. Any ideas? Thank you If its a rooted device you can try with this Process process = Runtime.getRuntime().exec(new String[] { "su", "-c", "netcfg eth0 192.168.0.123"}); process.waitFor(); And also you can use ifconfig instead of netcfg . 来源: https://stackoverflow.com/questions/23397803/assign-static-ip-to-ethernet-card-from-otg

What are the 0 bytes at the end of an Ethernet frame in Wireshark?

喜夏-厌秋 提交于 2019-12-04 07:27:40
after ARP protocol in a frame, there are many 0 bytes. Does anyone know the reason for the existence of these 0 bytes? Check the Ethernet II accordion, all the 0 are labelled as padding. Ethernet requires that all packets be at least 60 bytes long (64 bytes if you include the Frame Check Sequence at the end), so if a packet is less than 60 bytes long (including the 14-byte Ethernet header), additional padding bytes have to be added to the end of the packet. (Those padding bytes will not show up on packets sent by the machine running Wireshark; the padding is added by the Ethernet hardware, and

Hook up Raspberry Pi via Ethernet to laptop without router? [closed]

巧了我就是萌 提交于 2019-12-04 07:22:06
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 months ago . I'm working on a balloon project with a Raspberry Pi. When we potentially recover the Raspberry Pi, it will most likely be in a rural location and I'd like to turn off the Pi at that point safely. Without a router or network nearby, I was wondering if there is a way to hook up a Raspberry Pi with an Ethernet

Listening for an Ethernet Cable Unplugging Event for a TCP Server Application

余生长醉 提交于 2019-12-04 03:40:44
问题 I have a C# TCP server application. I detect disconnections of TCP clients when they disconnect from server but how can I detect a cable unplug event? When I unplug the ethernet cable I can't detect the disconnection. 回答1: You might want to apply "pinging" functionality, that will fail if there is TCP connection lose. Use this code to add extension method to Socket: using System.Net.Sockets; namespace Server.Sockets { public static class SocketExtensions { public static bool IsConnected(this

Filter options for sniff function in scapy

时光总嘲笑我的痴心妄想 提交于 2019-12-04 03:39:33
I'm working on a scapy based tool where at a point I need to sniff a packet based on protocol and the ip address of the destination I'd like to know about the ways in which filter option in sniff() function can be used. I tried using format in documentation but most of the times it results in problems like this. the filter of sniff function in scapy does not work properly . The one which I used was a=sniff(filter="host 172.16.18.69 and tcp port 80",prn = comp_pkt,count = 1) Thanks in advance! Jeff Bencteux sniff() uses Berkeley Packet Filter (BPF) syntax (the same one as tcpdump ), here are

Arduino DHCP failed to configure

烈酒焚心 提交于 2019-12-03 22:04:31
I am using the example ethernet sketch for a web client that comes bundled with the Arduino software without changing a thing except for the firmware address, which I changed to the one printed on the back of the ethernet shield. Whenever I connect the Arduino to my network and view the serial monitor, the only message I get is that it "Failed to configure Ethernet using DHCP". I have setup my Arduino Mega 2560 with an ethernet shield, correctly connecting ports 50 to MISO, 51 to MOSI, 52 to SCK, and 10 to SS (a.k.a. ETHCS as it is printed on the ethernet board). Do you guys have any idea why

What do I need to build to directly access the Ethernet frame bits in the kernel level?

狂风中的少年 提交于 2019-12-03 20:54:37
I would like to retrieve the Ethernet Frame bits for all the Ethernet frames on the wire no matter if they are destined (MAC level) for my machine or not. The logic for that has to be at the kernel level. So in order to achieve this do I need to build a separate kernel module or Ethernet driver or Ethernet network interface Note: I have just started learning Linux kernel module development for my project. I'm sorry if it is not the appropriate place to post this question. rodolk For receiving frames destined to all hosts you must set your network interface in promiscuous mode. For getting

Detecting network state (connected - disconnected) in C#

偶尔善良 提交于 2019-12-03 20:22:14
问题 I am in need of a piece of code that can detect if a network connection is connected or disconnected. The connected state would mean a cable was plugged into the Ethernet connection. A disconnected state would mean there is not cable connected. I can't use the WMI interface due to the fact that I'm running on Windows CE. I don't mind invoking the Win32 API but remember that I'm using Windows CE and running on the Compact Framework. 回答1: Check out this MSDN article: Testing for and Responding

Ethernet CRC32 calculation - software vs algorithmic result

前提是你 提交于 2019-12-03 11:33:22
I'm trying to calculate the Frame Check Sequence (FCS) of an Ethernet packet byte by byte. The polynomial is 0x104C11DB7 . I did follow the XOR-SHIFT algorithm seen here http://en.wikipedia.org/wiki/Cyclic_redundancy_check or here http://www.woodmann.com/fravia/crctut1.htm Assume the information that is supposed have a CRC is only one byte. Let's say it is 0x03. step: pad with 32 bits to the right 0x0300000000 align the polynomial and the data at the left hand side with their first bit that is not zero and xor them 0x300000000 xor 0x209823B6E = 0x109823b6e take remainder align and xor again

Create a layer 2 / ethernet socket with boost asio raw socket (in C++)

痴心易碎 提交于 2019-12-03 07:42:18
It is fairly easy to create IP, TCP or UDP sockets using boost::asio library. But when it comes to Ethernet sockets for instance, you need to implement boost/asio/basic_raw_socket.hpp As there are no examples of such a thing over the internet and as I spent a long time before finding the answer, I'll put my work-around in here. The most helpful resource I found was: AF_NETLINK (netlink) sockets using boost::asio A raw socket can be opened using the generic::raw_protocol stuff: std::string ifname("eth1"); typedef boost::asio::generic::raw_protocol raw_protocol_t; typedef boost::asio::generic: