EthernetNetIf Compatibility.
Dependents: XBeeWiFi_SPI_example
Fork of NetServicesSource by
Diff: services/ntp/NTPClient.cpp
- Revision:
- 5:dd63a1e02b1b
- Parent:
- 2:a4f97773c90f
--- a/services/ntp/NTPClient.cpp Fri Jul 09 14:46:47 2010 +0000 +++ b/services/ntp/NTPClient.cpp Tue Jul 27 15:59:42 2010 +0000 @@ -145,7 +145,7 @@ resetTimeout(); DBG("Opening connection\n"); m_state = NTP_PING; - Host localhost(IpAddr(127,0,0,1), NTP_CLIENT_PORT, "localhost"); + Host localhost(IpAddr(), NTP_CLIENT_PORT, "localhost"); //Any local address m_pUDPSocket->bind(localhost); set_time( 1280000000 ); //End of July 2010... just there to limit offset range process(); @@ -180,6 +180,7 @@ m_pkt.refTm_f = m_pkt.origTm_f = m_pkt.rxTm_f = m_pkt.txTm_f = 0; + #ifdef __DEBUG //Hex Dump: DBG("\r\nDump Tx:\r\n"); for(int i = 0; i< sizeof(NTPPacket); i++) @@ -187,6 +188,7 @@ DBG("%02x ", *((char*)&m_pkt + i)); } DBG("\r\n\r\n"); + #endif len = m_pUDPSocket->sendto( (char*)&m_pkt, sizeof(NTPPacket), &m_host ); if(len < sizeof(NTPPacket)) @@ -217,6 +219,7 @@ if(len < sizeof(NTPPacket)) //TODO: Accept chunks { onResult(NTP_PRTCL); close(); return; } + #ifdef __DEBUG //Hex Dump: DBG("\r\nDump Rx:\r\n"); for(int i = 0; i< sizeof(NTPPacket); i++) @@ -224,6 +227,7 @@ DBG("%02x ", *((char*)&m_pkt + i)); } DBG("\r\n\r\n"); + #endif if( m_pkt.stratum == 0) //Kiss of death message : Not good ! {