Thanks Martine!
Will try this tomorrow!

2015-04-29 22:04 GMT+02:00 Martine Lenders <authmille...@gmail.com>:

> Hey Baptiste,
> though there is no example yet you can use the new network stack never the
> less. Just take one of the test applications for the device you want to use
> and compile them with the modules `ng_ipv6` and `ng_udp`. If you use an
> IEEE 802.15.4 device (which are currently the only ones in master) you need
> to add `ng_sixlowpan_frag`, too. The threads will be started properly by
> `auto_init` (which should have been initialized automatically).
>
> If you want to listen on a port just call
>
> ng_netreg_t entry = { thread_getpid(), port };
> ng_netreg_register(NG_NETTYPE_UDP, &entry);
>
> while (1) {
>     msg_receive(&msg);
>
>     switch (msg.type) {
>         NG_NETAPI_MSG_TYPE_RCV:
>             /* do something with the ng_pktsnip_t* at msg.content.ptr */
>             break;
>     }
> }
>
> If you want to send a pktsnip payload via UDP use:
>
> ng_netreg_t *sendto = ng_netreg_lookup(NG_NETTYPE_UDP,
> NG_NETREG_DEMUX_CTX_ALL);
> udp = ng_udp_hdr_build(payload, sport, 2, dport, 2);
> ipv6 = ng_ipv6_hdr_build(udp, NULL, 0, (uint8_t *)dst_addr, 16);
>
> ng_pktbuf_hold(ipv6, ng_netreg_num(NG_NETTYPE_UDP,
> NG_NETREG_DEMUX_CTX_ALL) - 1);
> while (sendto) {
>     ng_netapi_send(sendto->pid, ipv6);
>     sendto = sendto->next;
> }
>
> Be adviced that it is always a good idea to check if the returned values
> are not NULL (in case of a full packet buffer). Also: I did not compile
> this, so be warned of syntax errors ;-)
>
> Cheers,
> Martine
>
> 2015-04-28 13:54 GMT+02:00 Baptiste Clenet <bapcle...@gmail.com>:
>
>> Great Hauke! I'm looking forward to using the all new network stack from
>> UDP to the transceiver :-)
>>
>> 2015-04-28 13:16 GMT+02:00 Hauke Petersen <hauke.peter...@fu-berlin.de>:
>>
>>>  Hi Baptiste,
>>>
>>> there is one small thing missing, namely a concept for initializing
>>> radio drivers and MAC layers in an automated fashion (as in auto_init). But
>>> I have already a concept in mind, hopefully I will get it done tomorrow -
>>> and with that I will update the example for UDP. So stay tuned :-)
>>>
>>> Cheers,
>>> Hauke
>>>
>>>
>>> On 28.04.2015 10:10, Baptiste Clenet wrote:
>>>
>>> Hi,
>>>
>>>  Could you add an example/test for the new ng_udp? It will be easier to
>>> use it then.
>>> *@haukepetersen @authmillenon *
>>>
>>>  Cheers,
>>>
>>>  --
>>>
>>> *Clenet Baptiste *
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> devel mailing 
>>> listdevel@riot-os.orghttps://lists.riot-os.org/mailman/listinfo/devel
>>>
>>>
>>>
>>> _______________________________________________
>>> devel mailing list
>>> devel@riot-os.org
>>> https://lists.riot-os.org/mailman/listinfo/devel
>>>
>>>
>>
>>
>> --
>> *Clenet Baptiste*
>>
>>
>> _______________________________________________
>> devel mailing list
>> devel@riot-os.org
>> https://lists.riot-os.org/mailman/listinfo/devel
>>
>>
>
> _______________________________________________
> devel mailing list
> devel@riot-os.org
> https://lists.riot-os.org/mailman/listinfo/devel
>
>


-- 

*Clenet BaptisteFR: +33 6 29 73 05 39*
*Élève-Ingénieur ESEO Angers, dernière année, spécialisation: Architecte
système temps réél embarqué*


*Bidiplôme Master Robotics à l'Université de Plymouth en 2013-2014*
_______________________________________________
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel

Reply via email to