J721EXSOMXEVM: udp_send: no route to 192.168.3.1

Part Number: J721EXSOMXEVM

Tool/software:

Hi,

I am trying to use enet_lwip example from the pdk and added a small udp_client thread which tried to send some messages to the server.

Server ip: 192.168.3.1
Client ip; 192.168.3.30

I have added an app as part of LWIP_APP_INIT, lets call it chris_udp_app, and if the chris_udp_thread code is udp_server, then it seems to work to some extent, i.e, I can receive data on this server thread from the client that is running on a linux pc.

But if I configure the chris_udp_thread code to be udp_client, then I get the error that udp_send: no route to server ip address.

udp_client thread:

    struct sockaddr_in si_other;
	int s;
    socklen_t slen = sizeof(si_other);
	char message[64];
	char serv_addr[] = "192.168.3.1";
	int PORT = 1264;

	if ( (s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
	{
		puts("socket failed");
		return;
	}

	memset((char *) &si_other, 0, sizeof(si_other));
	si_other.sin_family = AF_INET;
	si_other.sin_port = htons(PORT);
	
	if (inet_aton(serv_addr , &si_other.sin_addr) == 0) 
	{
		fprintf(stderr, "inet_aton() failed\n");
		return;
	}

	while(1)
	{
        sprintf(message, "Hello from TI client");
		
		//send the message
		if (sendto(s, message, strlen(message) , 0 , (struct sockaddr *) &si_other, slen)==-1)
		{
			puts("sendto() failed");
			return;
		}
	}


Note: I have disabled all the apps from the config file, 

#define LWIP_CHARGEN_APP 0

#define LWIP_DNS_APP 0
#define LWIP_HTTPD_APP 0
//#define LWIP_HTTPD_APP_NETCONN 0
/* Set this to 1 to use the netconn http server,
* otherwise the raw api server will be used. */
/*#define LWIP_HTTPD_APP_NETCONN */
#define LWIP_NETBIOS_APP 0
#define LWIP_NETIO_APP 0
#define LWIP_MDNS_APP 0
#define LWIP_MQTT_APP 0
#define LWIP_PING_APP 0
#define LWIP_RTP_APP 0
#define LWIP_SHELL_APP 0
#define LWIP_SNMP_APP 0
//Not supported yet
#define LWIP_SNTP_APP 0
#define LWIP_SOCKET_EXAMPLES_APP 0
#define LWIP_TCPECHO_APP 0
#define LWIP_TCPECHO_APP_NETCONN 0
/* Set this to 1 to use the netconn tcpecho server,
* otherwise the raw api server will be used. */
/*#define LWIP_TCPECHO_APP_NETCONN */
#define LWIP_TFTP_APP 0
#define LWIP_UDPECHO_APP 0
#define LWIP_LWIPERF_APP 0
//Experimental port
#define LWIP_UDPERF_APP 0
Added following to the config header file,
#define LWIP_PORT_INIT_IPADDR(addr) IP4_ADDR((addr), 192,168,3,30)
#define LWIP_PORT_INIT_GW(addr) IP4_ADDR((addr), 192,168,3,1)
#define LWIP_PORT_INIT_NETMASK(addr) IP4_ADDR((addr), 255,255,255,0)

 Also added this to the test.c,

#if LWIP_IPV4
LWIP_PORT_INIT_GW(&gw);
LWIP_PORT_INIT_IPADDR(&ipaddr);
LWIP_PORT_INIT_NETMASK(&netmask);
//ip4_addr_set_zero(&gw);
//ip4_addr_set_zero(&ipaddr);
//ip4_addr_set_zero(&netmask);
#if USE_ETHERNET_TCPIP
Thanks,
Moses