X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=projects%2Fexample%2Fsample.net.udp%2Fsrc%2Fsketch.c;h=43f3e0e301b5cddef6ffbaab4661c4ebad2de33f;hb=HEAD;hp=d4544ce7b7fe3ee26ca4d70fd265aeffda8667ef;hpb=46823da6b6b38411dd4dc824f9ec8deeb1134d74;p=mimic%2FMiMicSDK.git diff --git a/projects/example/sample.net.udp/src/sketch.c b/projects/example/sample.net.udp/src/sketch.c index d4544ce..43f3e0e 100644 --- a/projects/example/sample.net.udp/src/sketch.c +++ b/projects/example/sample.net.udp/src/sketch.c @@ -5,7 +5,7 @@ #include "boot/sketch.h" #include "NyLPC_net.h" -#include "NyLPC_uipService.h" +#include "../netif/mimicip/NyLPC_cMiMicIpNetIf.h" #include "NyLPC_http.h" #include "NyLPC_utils.h" #include @@ -13,14 +13,14 @@ /** * UDP loopback test */ -NyLPC_TcNet_t net; -NyLPC_TcUdpSocket_t udp; -char buf[512]; +const struct NyLPC_TiNetInterface_Interface* netif; +NyLPC_TiUdpSocket_t* udp; void setup(void) { //uipサービス初期化。いろいろ利用可能に。 - NyLPC_cNet_initialize(&net); - NyLPC_cUdpSocket_initialize(&udp,9999,buf,512); + netif=NyLPC_cMiMicIpNetIf_getNetInterface(); + NyLPC_cNet_initialize(netif); + udp=NyLPC_cNet_createUdpSocketEx(9999,NyLPC_TSocketType_UDP_NORMAL); } @@ -36,13 +36,13 @@ void loop(void) NyLPC_cNetConfig_initialize(&c2,NyLPC_TBool_TRUE); NyLPC_cNetConfig_setIpAddr(&c2,192,168,128,39); NyLPC_cNetConfig_setGateway(&c2,192,168,128,254); - NyLPC_cNet_start(&net,&c2); + NyLPC_cNet_start(&(c2.super)); for(;;) { - rs=NyLPC_cUdpSocket_precv(&udp,&b,&info,1000); + rs=NyLPC_iUdpSocket_precv(udp,&b,&info,1000); if(rs>0){ - NyLPC_cUdpSocket_send(&udp,&info->peer_ip,info->peer_port,b,rs,1000); - NyLPC_cUdpSocket_pseek(&udp); + NyLPC_iUdpSocket_send(udp,&info->peer_ip,info->peer_port,b,rs,1000); + NyLPC_iUdpSocket_pseek(udp); } } }