I want to send DHCP discovery messages with the ESP8266 manually.
I have made the following code:
#define UDP_BROADCAST_PORT 3444
char DeviceBuffer[40] = {0};
wifi_set_opmode(STATION_MODE);
wifi_station_dhcpc_stop();
myEspconn.type = ESPCONN_UDP;
myEspconn.state = ESPCONN_NONE;
myEspconn.proto.udp->remote_port = UDP_BROADCAST_PORT; // ESP8266 udp remote port
myEspconn.proto.udp->local_port = UDP_BROADCAST_PORT; // ESP8266 udp local port
remote_ip = IPADDR_NONE;
os_memcpy(myEspconn.proto.udp->remote_ip, &remote_ip, 4);
wifi_get_macaddr(STATION_IF, hwaddr);
os_sprintf(DeviceBuffer, "%s" MACSTR "!", ESP8266_MSG, MAC2STR(hwaddr));
espconn_send(&myEspconn, DeviceBuffer, os_strlen(DeviceBuffer));
Espconn_send is returning error-code -4.
Could somebody help me and explain what could be wrong here.
Best regards,
Wamor