I am trying to build a socket to retrieve the ethernet packets from ECU(I do not know much about the ECU). When i run my code on windows there is no problem and the code runs correctly. But when i run my code on Debian it gets stuck at s.recv(1024).
I have already set static ip in /etc/network/interfaces as follows:
Code: Select all
iface eth0 inet static
address 160.48.199.91
netmask 255.255.255.0
gateway 160.48.199.254
The simple code is as below:
Code: Select all
import socket
import sys
HOST = "160.48.199.91"
port = 30490
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_UDP)
s.bind((HOST, 30490))
while True:
data = s.recvfrom(1024)
print(data)
There is no LAN or Router. When i check netstat -s i see that there are 0 UDP and 0 TCP messages received. But when i check in Wireshark on Debian i could see the displayed UDP packets. Does it mean that the UDP packets are reaching the Raspberry Pi but not received by Debian ? Or are these packets being dropped ? What could be the problem ?
Please help me with this problem i urgently need it for my thesis.