lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] basic introduction example design starting point for a


From: sirnails
Subject: Re: [lwip-users] basic introduction example design starting point for a beginner
Date: Wed, 7 Oct 2009 03:07:52 -0700 (PDT)

so - this is the simplest UDP send that I have been able to come up with - i
just thought i would share this so anyone in the same position as me could
use this as a place to get started.

I welcome criticism / suggestions / improvements etc...


int main(void)
{
struct udp_pcb * pcb;
struct pbuf * data1, * data2;
struct ip_addr boardip;

outgoing = "hello";
boardip.addr = 0xC0A82199; // 192.168.33.153 - the destination ip address

// ...
// setup system, memory, pbufs, udp, ipaddresses, netif, timer etc...
//  ...

        do{
                data1 = pbuf_alloc(PBUF_LINK, sizeof(outgoing), PBUF_REF);
                pcb = udp_new();
                udp_connect(pcb, &boardip, 10017); // 10017 - the destination 
UDP port
                data1->payload = &outgoing;
                extern void ethernetif_input(struct netif *netif);
                ethernetif_input(&netif);
                udp_send(pcb, data1);
                udp_disconnect(pcb);    
                pbuf_free(data1);
                udp_remove(pcb);
        }while(1);



Thanks for any help!

-- 
View this message in context: 
http://www.nabble.com/basic-introduction-example-design-starting-point-for-a-beginner-tp25472266p25783759.html
Sent from the lwip-users mailing list archive at Nabble.com.





reply via email to

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