Hallo, hat hier jemand Erfahrung mit dem Stack lwip?
Auf einem Mikrcrocontroller läuft der lwip Stack. Das versenden von
UDP-Packeten an meinen PC funktioniert. Nur der Empfang von UDP-Packeten
vom PC zum Mikrocontroller funktioniert nicht.
1 | void main (void)
|
2 | {
|
3 | ..............
|
4 | while(1)
|
5 | {
|
6 | recvUDP();
|
7 | }
|
8 | }
|
9 |
|
10 | void udp_echo_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port)
|
11 | {
|
12 | if (p != NULL)
|
13 | {
|
14 | udp_sendto(pcb, p, addr, port)/
|
15 | pbuf_free(p);
|
16 | }
|
17 | }
|
18 |
|
19 | void recvUDP(void)
|
20 | {
|
21 | char buffer[1024];
|
22 | err_t retval;
|
23 | struct ip_addr ipaddr;
|
24 | struct udp_pcb *pcb;
|
25 | struct pbuf *pb;
|
26 | IP4_ADDR(&ipaddr, 192,167,1,7); // IP vom PC
|
27 | pcb = udp_new();
|
28 | retval = udp_bind(pcb, IP_ADDR_ANY, 2222);
|
29 |
|
30 | udp_connect(pcb, &ipaddr, 2222);
|
31 | udp_recv(pcb, udp_echo_recv, NULL);
|
32 | }
|
Vielleiccht sollte ich mal auf der Ethernet Schicht mal nachschauen ob
überhaupt was am Mikrocontroller ankommt. Weiss allerdings nicht wo ich
da
eingreifen müsste.