lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Detecting broadcast packets?


From: girrian seedo
Subject: [lwip-users] Detecting broadcast packets?
Date: Mon, 3 Sep 2012 14:16:24 +0300

Hi, 

I have set up an UDP-server using RAW API

    pcb = udp_new();
    if (!pcb) {
        xil_printf("Error creating PCB. Out of Memory\r\n");
        return -1;
    }
    /* bind to specified @port */
    err = udp_bind(pcb, IP_ADDR_ANY, server_port);
    if (err != ERR_OK) {
        xil_printf("Unable to bind to port %d: err = %d\r\n",server_port, err);
        return -2;
    }

    udp_recv(pcb, udp_reciever_routine, NULL);

My server can now receive and send UDP packets. I would like to know is it possible to make it detect if client has send an UDP packet into a broadcast address. In that way I can respond with my custom UDP packet. Because now e.g. if I send a packet to a broadcast address, server detects it but I can't react it in a anyway. Like this,

udp_input: received datagram of length 215

UDP header:

+-------------------------------+

| 138 | 138 | (src port, dest port)

+-------------------------------+

| 215 | 0x12db | (len, chksum)

+-------------------------------+

udp (10.0.0.255, 70) <-- (10.0.0.5, 9006)

pcb (0.0.0.0, 70) --- (0.0.0.0, 0)


Of course I can pick this packet up if I send it to my server port 70. But is there any other way, so it would detect it if I send it to a any port?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]