0
votes

I have a working bare metal code that implements simple TCP server using lwip 2.0.2 It runs on Xilinx UltraScale+ Kintex.

Now I want to use raw api.

The code is:

struct raw_pcb *pcb;
pcb = raw_new_ip_type(IPADDR_TYPE_V4 , 0);  //pcb!=null
err = raw_bind (pcb, IP4_ADDR_ANY); //err=0
raw_recv(pcb, raw_recv_callback, NULL);


u8_t raw_recv_callback (void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr)
{



    return 0;
}

From a (very) simple windows application I tried to connect and got an error. Can you please advise: In case of using raw api, should I still use tcp API after the bind step ?

In case of using only TCP api, the connection from the remote windows application works fine.

I found few sample code in https://github.com/tmatsuya/xapp1026.git But non of them is using the raw api.

Thank you in advance, Zvika

1
I need TCP\UDP frames. According to Xilinx code samples, I should not use raw_? API.Zvi Vered

1 Answers

0
votes

lwIP has a separate contrib repository that has a tcpecho_raw example: https://git.savannah.nongnu.org/cgit/lwip/lwip-contrib.git/tree/apps.

It uses tcp_bind(raw_pcb, ...), tcp_listen(raw_pcb), and tcp_accept(raw_pcb, ...) on the server side.

The raw_bind() and related functions are used for "Implementation of raw protocol PCBs for low-level handling of different types of protocols besides (or overriding) those already available in lwIP." See https://www.nongnu.org/lwip/2_1_x/group__raw__raw.html.

If you want to use the TCP protocol, just use the tcp_*() functions.