title: Creating a RAW UDP connection in lwip ARP
body: <p>I am currently working to create a simple transfer protocol over Ethernet. I have a SP605 Xilinx evaluation board which I am using to debug the Ethernet portion of our project. I attempted to cannibalize the example but have so far been unsuccessful. Currently, the communication needs to only be one way. Currently, I am trying to see the data being sent with netcat. I also have wireshark open and am seeing the system get stuck repeatedly asking:</p>
  
  <p>2217    1323.697811000  Xilinx_00:01:02 Broadcast<br>
   ARP    60  Who has 192.168.1.11?  Tell 192.168.1.10</p>
  
  <p>I can see the Host computer reply with:</p>
  
  <p>2217    1323.697811000  Xilinx_00:01:02 Broadcast<br>
  ARP 60  Who has 192.168.1.11?  Tell 192.168.1.10</p>
  
  <p>I feel like I have some issues with the configuration but cannot figure out how what it is. I think it might have something to do with a not having a recv handler set but I am not sure.</p>
  
  <p>Below is the code I am using. lwip_init() is mimicking the call from the examples provided by Xilinx.</p>
  
  <pre><code>    /*
   * main.c
   *
   *  Created on: Sep 24, 2013
   *      Author: Ian
   */
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  #include &lt;stdio.h&gt;
  #include "lwip/init.h"
  #include "xparameters.h"
  #include "netif/xadapter.h"
  #include "xenv_standalone.h"
  #include "platform_config.h"
  #include "xparameters.h"
  #include "xintc.h"
  #include "xil_exception.h"
  #include "mb_interface.h"
  #include "xtmrctr_l.h"
  #include "lwip/udp.h"
  #include "lwipopts.h"
  
  #include "xil_printf.h"
  
  struct ip_addr ipaddr, ipaddr_remote, netmask, gw;
  void udp_test(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port);
  
  
  void print_ip(char *msg, struct ip_addr *ip)
  {
      print(msg);
      xil_printf("%d.%d.%d.%d\r\n", ip4_addr1(ip), ip4_addr2(ip),
              ip4_addr3(ip), ip4_addr4(ip));
  }
  
  void print_ip_settings(struct ip_addr *ip, struct ip_addr *mask, struct ip_addr *gw)
  {
      print_ip("Board IP:       ", ip);
      print_ip("Netmask :       ", mask);
      print_ip("Gateway :       ", gw);
  }
  
  int main()
  {
  
      err_t error;
      struct netif *netif, server_netif;
      struct udp_pcb *udp_1;
      struct pbuf  *p;
      char data[8] = "01234567";
      u16_t  Port;
      Port = 69;
      int count = 0;
      int n = 0;
      int buflen = 8;
  
      /* the mac address of the board. this should be unique per board */
      unsigned char mac_ethernet_address[] = { 0x00, 0x0a, 0x35, 0x00, 0x01, 0x02 };
  
      netif = &amp;server_netif;
  
      xil_printf("\r\n\r\n");
      xil_printf("-----lwIP RAW Application ------\r\n");
      /* initliaze IP addresses to be used */
  
      IP4_ADDR(&amp;ipaddr_remote,  192, 168,   1, 11);
      IP4_ADDR(&amp;ipaddr,  192, 168,   1, 10);
      IP4_ADDR(&amp;netmask, 255, 255, 255,  0);
      IP4_ADDR(&amp;gw,      192, 168,   1,  1);
      print_ip_settings(&amp;ipaddr, &amp;netmask, &amp;gw);
  
      lwip_init();
  
      if (!xemac_add(netif, &amp;ipaddr, &amp;netmask, &amp;gw, mac_ethernet_address, PLATFORM_EMAC_BASEADDR)) {
          xil_printf("Error adding N/W interface\r\n");
          return -1;
      }
      netif_set_default(netif);
  
      netif_set_up(netif);
  
      Xil_ExceptionEnable(); //Setup complete start interrupts
  
  
      udp_1 = udp_new();
  
      error = udp_bind(udp_1, IP_ADDR_ANY, Port);
  
      if (error != 0)
      {
          xil_printf("Failed %d\r\n", error);
      }
      else if (error == 0)
      {
          xil_printf("Success\r\n");
      }
      error = udp_connect(udp_1, &amp;ipaddr_remote, Port);
      if (error != 0)
      {
          xil_printf("Failed %d\r\n", error);
      }
      else if (error == 0)
      {
          xil_printf("Success\r\n");
      }
  
  
  while(1)
      {
      count++;
      xemacif_input(netif);
      if (count == 100000)
      {
          p = pbuf_alloc(PBUF_TRANSPORT, buflen, PBUF_POOL);
          if (!p) {
              xil_printf("error allocating pbuf\r\n");
              return ERR_MEM;
          }
          memcpy(p-&gt;payload, data, buflen);
          udp_send(udp_1, p);
          xil_printf("SEND\r\n");
          count = 0;
          pbuf_free(p);
      }
      }
      data[1] = '2';
  }
  </code></pre>