This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088
Fork of libMiMic by
Revision 115:fa79286d8ea4, committed 2017-02-24
- Comitter:
- furutani
- Date:
- Fri Feb 24 04:43:41 2017 +0000
- Parent:
- 114:f6aef16d4e60
- Commit message:
- Delete missing include line.; Add parameter "timeout" to TCPSocket::connect(), precv().; Fix to send ARP request to default gateway when connecting to IP address of different segment.;
Changed in this revision
--- a/core/netif/mimicip/NyLPC_cMiMicIpNetIf.c Sat Jun 04 06:51:04 2016 +0000 +++ b/core/netif/mimicip/NyLPC_cMiMicIpNetIf.c Fri Feb 24 04:43:41 2017 +0000 @@ -408,7 +408,11 @@ } NyLPC_cMutex_unlock(&(inst->_mutex)); //ARPリクエストを代わりに送信 - NyLPC_cMiMicIpNetIf_sendArpRequest(&((struct NyLPC_TIPv4Header*)i_eth_payload)->destipaddr); + { + //LocalIP以外ならdefaultRootへ変換 + NyLPC_TBool isLocal = NyLPC_cIPv4Config_isLocalIP(inst->_netinfo.current_config, &((struct NyLPC_TIPv4Header*)i_eth_payload)->destipaddr); + NyLPC_cMiMicIpNetIf_sendArpRequest(isLocal ? &((struct NyLPC_TIPv4Header*)i_eth_payload)->destipaddr : &(inst->_netinfo.current_config->dr_addr)); + } return; }
--- a/mbed/TcpSocket.cpp Sat Jun 04 06:51:04 2016 +0000 +++ b/mbed/TcpSocket.cpp Fri Feb 24 04:43:41 2017 +0000 @@ -20,9 +20,9 @@ { NyLPC_iTcpSocket_finalize(this->_inst); } - bool TcpSocket::connect(const IpAddr& i_addr,unsigned short i_port) + bool TcpSocket::connect(const IpAddr& i_addr,unsigned short i_port, unsigned int timeout) { - return NyLPC_iTcpSocket_connect(this->_inst,&(i_addr.addr.v4),i_port,TIMEOUT_IN_MSEC)?true:false; + return NyLPC_iTcpSocket_connect(this->_inst,&(i_addr.addr.v4),i_port,timeout)?true:false; } bool TcpSocket::send(const void* i_tx,unsigned short i_tx_size) @@ -43,13 +43,13 @@ const void* rx; return NyLPC_iTcpSocket_precv(this->_inst,&rx,0)>0; } - int TcpSocket::precv(const void* &i_rx) + int TcpSocket::precv(const void* &i_rx, unsigned int timeout) { - return NyLPC_iTcpSocket_precv(this->_inst,&i_rx,TIMEOUT_IN_MSEC); + return NyLPC_iTcpSocket_precv(this->_inst,&i_rx,timeout); } - int TcpSocket::precv(const char* &i_rx) + int TcpSocket::precv(const char* &i_rx, unsigned int timeout) { - return NyLPC_iTcpSocket_precv(this->_inst,(const void**)&i_rx,TIMEOUT_IN_MSEC); + return NyLPC_iTcpSocket_precv(this->_inst,(const void**)&i_rx,timeout); } void TcpSocket::pseek(unsigned short i_rx_seek) {
--- a/mbed/TcpSocket.h Sat Jun 04 06:51:04 2016 +0000 +++ b/mbed/TcpSocket.h Fri Feb 24 04:43:41 2017 +0000 @@ -27,7 +27,7 @@ * @param i_host_addr * must be IPv4 address format. */ - bool connect(const IpAddr& i_addr,unsigned short i_port); + bool connect(const IpAddr& i_addr,unsigned short i_port, unsigned int timeout=5*1000); bool send(const void* i_tx,unsigned short i_tx_size); /** * This function return recieved data and size. @@ -40,8 +40,8 @@ * n==0 Timeout (connection still established) * n>0 Success. readable data size in i_rx. */ - int precv(const void* &i_rx); - int precv(const char* &i_rx); + int precv(const void* &i_rx, unsigned int timeout=5*1000); + int precv(const char* &i_rx, unsigned int timeout=5*1000); /** * true if precv has data. * This can avoid the block of precv.
--- a/mbed/mimic.h Sat Jun 04 06:51:04 2016 +0000 +++ b/mbed/mimic.h Fri Feb 24 04:43:41 2017 +0000 @@ -23,7 +23,7 @@ #include "mod/ModUPnPDevice.h" #include "mod/ModWebSocket.h" #include "mod/ModJsonRpc.h" -#include "LocalFileSystem2.h" +//#include "LocalFileSystem2.h" #include "netif/INetIf.h" #include "netif/MiMicNetIf.h"