udpecho.c
ubixos/types.h
lib/kprintf.h
net/api.h
net/sys.h
src/sys/net/net/udpecho.c
net/ipv4/ip.h
arch/lib.h
net/netif.h
net/udp.h
arch/cpu.h
arch/sys_arch.h
net/tcp.h
ubixos/types.h
sys/_types.h
net/arch.h
net/ipv4/icmp.h
net/lwipopts.h
net/def.h
net/mem.h
lib/kprintf.h
net/ipv4/ip_addr.h
net/err.h
net/api.h
net/opt.h
net/sys.h
net/pbuf.h
net/debug.h
net/ipv4/inet.h
arch/cc.h
void void udpecho_init (void) udpecho_init void NULL sys_thread_new udpecho_thread
void void udpecho_thread (void *arg) udpecho_thread void * arg ip_addr::addr buffer kprintf netbuf_copy netbuf_delete netbuf_fromaddr netbuf_fromport netconn_bind netconn_connect netconn_new netconn_recv netconn_send NETCONN_UDP NULL udpecho_init

    /*
    *Copyright(c)2001,SwedishInstituteofComputerScience.
    *Allrightsreserved.
    *
    *Redistributionanduseinsourceandbinaryforms,withorwithout
    *modification,arepermittedprovidedthatthefollowingconditions
    *aremet:
    *1.Redistributionsofsourcecodemustretaintheabovecopyright
    *notice,thislistofconditionsandthefollowingdisclaimer.
    *2.Redistributionsinbinaryformmustreproducetheabovecopyright
    *notice,thislistofconditionsandthefollowingdisclaimerinthe
    *documentationand/orothermaterialsprovidedwiththedistribution.
    *3.NeitherthenameoftheInstitutenorthenamesofitscontributors
    *maybeusedtoendorseorpromoteproductsderivedfromthissoftware
    *withoutspecificpriorwrittenpermission.
    *
    *THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND
    *ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE
    *IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE
    *AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE
    *FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL
    *DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS
    *ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)
    *HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT
    *LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY
    *OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF
    *SUCHDAMAGE.
    *
    *ThisfileispartofthelwIPTCP/IPstack.
    *
    *Author:AdamDunkels<adam@sics.se>
    *
    *$Id: udpecho_8c.xml 88 2016-01-12 00:11:29Z reddawg $
    */

    #include<ubixos/types.h>
    #include<lib/kprintf.h>

    #include"net/api.h"
    #include"net/sys.h"

    /*-----------------------------------------------------------------------------------*/
    void
    udpecho_thread(void*arg)
    {
    staticstructnetconn*conn;
    staticstructnetbuf*buf;
    staticstructip_addr*addr;
    staticunsignedshortport;
    charbuffer[4096];

    kprintf("1");
    conn=netconn_new(NETCONN_UDP);
    kprintf("2");
    netconn_bind(conn,NULL,7);
    kprintf("3");

    while(1){
    kprintf("a");
    buf=netconn_recv(conn);
    kprintf("b");
    addr=netbuf_fromaddr(buf);
    kprintf("c");
    port=netbuf_fromport(buf);
    kprintf("d");
    netconn_connect(conn,addr,port);
    kprintf("e");
    netconn_send(conn,buf);
    kprintf("f");
    netbuf_copy(buf,buffer,sizeof(buffer));
    kprintf("got%s\n",buffer);
    netbuf_delete(buf);
    kprintf("g");
    }
    }
    /*-----------------------------------------------------------------------------------*/
    void
    udpecho_init(void)
    {
    sys_thread_new(udpecho_thread,NULL);
    }