Free-RTOS 发送udp数据

extern struct netif network_interfaces[1];
void interface_init_1(void)
{
  for(int i = 0; i < 1; i++)
  {

    ip4_addr_t ipaddr, netmask, gw;

    ip4_addr_set_zero(&gw);
    ip4_addr_set_zero(&ipaddr);
    ip4_addr_set_zero(&netmask);
    /* network_interfaces[i] takes the IPV4 addresses from the respective configuration */

	  IP4_ADDR((&gw), 192,168, 0, 1);
	  IP4_ADDR((&ipaddr), 192, 168, 0, 200);
	  IP4_ADDR((&netmask), 255,255,255, 0);

    netif_set_default( netif_add(&network_interfaces[i], &ipaddr, &netmask, &gw, NULL, enet_ethernetif_init, tcpip_input) );
    netif_set_up(&network_interfaces[i]);
  }
}
char msg[8192] = "MPC5748G";
void vInitTask(void* pvParamateres){
    struct netconn *conn;
    struct netbuf *buf;
    ip_addr_t dst_addr;

    int i;

    err_t connection_err, send_err;
     u16_t dst_port = 7000;

     /* init the stack */
     tcpip_init(NULL, NULL);
     interface_init_
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值