Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of net-test by
main.cpp
- Committer:
- infinnovation
- Date:
- 2016-10-13
- Revision:
- 0:dcf432232b87
- Child:
- 1:e01aa8a340ad
File content as of revision 0:dcf432232b87:
#include "mbed.h" #include "EthernetInterface.h" #include "chlibs.h" #define PEER "10.212.1.246" EthernetInterface eth; static void try_connect(unsigned port) { INFO("connect %s:%u", PEER, port); TCPSocket sock; int err = sock.open(ð); if (err < 0) { ch_report("sock.open", err); return; } err = sock.connect(PEER, port); if (err < 0) { ch_report("sock.connect", err); return; } } int main() { ch_log_level = CH_LOG_INFO; INFO("net-test %s %s", __DATE__, __TIME__); int err = eth.connect(); if (err < 0) ch_fail("eth.connect", err); INFO("IP address %s", eth.get_ip_address()); try_connect(7); INFO("End"); return 0; }