本文整理汇总了C++中EthernetInterface::getGateway方法的典型用法代码示例。如果您正苦于以下问题:C++ EthernetInterface::getGateway方法的具体用法?C++ EthernetInterface::getGateway怎么用?C++ EthernetInterface::getGateway使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EthernetInterface
的用法示例。
在下文中一共展示了EthernetInterface::getGateway方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mbed_mac_address
void
tcpClient_main(intptr_t exinf) {
EthernetInterface network;
TCPSocketConnection socket;
/* syslogの設定 */
SVC_PERROR(syslog_msk_log(LOG_UPTO(LOG_INFO), LOG_UPTO(LOG_EMERG)));
syslog(LOG_NOTICE, "tcpClient:");
syslog(LOG_NOTICE, "Sample program starts (exinf = %d).", (int_t) exinf);
syslog(LOG_NOTICE, "LOG_NOTICE: Network Setting up...");
#if (USE_DHCP == 1)
if (network.init() != 0) { //for DHCP Server
#else
if (network.init(IP_ADDRESS, SUBNET_MASK, DEFAULT_GATEWAY) != 0) { //for Static IP Address (IPAddress, NetMasks, Gateway)
#endif
syslog(LOG_NOTICE, "Network Initialize Error");
return;
}
syslog(LOG_NOTICE, "Network was initialized successfully");
while (network.connect(5000) != 0) {
syslog(LOG_NOTICE, "LOG_NOTICE: Network Connect Error");
}
syslog(LOG_NOTICE, "MAC Address is %s", network.getMACAddress());
syslog(LOG_NOTICE, "IP Address is %s", network.getIPAddress());
syslog(LOG_NOTICE, "NetMask is %s", network.getNetworkMask());
syslog(LOG_NOTICE, "Gateway Address is %s", network.getGateway());
syslog(LOG_NOTICE, "Network Setup OK...");
while (socket.connect(SERVER, HTTP_PORT) < 0) {
syslog(LOG_EMERG, "Unable to connect to (%s) on port (%d)", SERVER, HTTP_PORT);
wait(1.0);
}
ClientGreet(&socket);
socket.close();
syslog(LOG_NOTICE, "program end");
}
// set mac address
void mbed_mac_address(char *mac) {
// PEACH1
mac[0] = 0x00;
mac[1] = 0x02;
mac[2] = 0xF7;
mac[3] = 0xF0;
mac[4] = 0x00;
mac[5] = 0x00;
}