import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class SendUdp
{
public static void main (String[] args) {
try {
System.out.println("create socket");
DatagramSocket socket = new DatagramSocket(8027);
socket.setBroadcast(true);
socket.connect(InetAddress.getByName("255.255.255.255"), 8027);
byte[] buf = new byte[100];
for (int i = 0; i < 100; i++) {
System.out.println("sending " + i);
DatagramPacket packet = new DatagramPacket(buf, i);
socket.send(packet);
Thread.sleep(10);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
but all packets I receive have the length set to either 12 or 60. As the WLAN is WPA encrypted and the MAC header etc. come on top, I expected packet lengths somewhere between 70 and 170 bytes...
wifi_promiscuous_rx(uint8 *buf, uint16 len)
I understand that the promiscuous mode does not provide the full packet content but I expected the length to be accurate. The best "documentation" that provides insights into the format of the buffer provided to the callback is this: https://github.com/ly0/esp8266-smartlink/blob/master/network_80211.h which seems to be partly provided by Espressif - but it does not explain the 12 byte packets and does not provide any details about what the SDk makes available to the callback. When the java code is running, the number of 12 byte packets received by the ESP is dramatically higher so I suspect that these are kind of the stubs representing the UDP packets... Looking at the first 12 bytes of the buffer for these packets there is no pattern visible that could represent the real packet length .
Any further documentation is greatly welcome!!