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.
Dependencies: NetworkSocketAPI WizFi310Interface mbed
Prerequisite
This example shows that Wizwiki-W7500 and WizFi310 operates as a TCP server. When receiving data from a TCP client, it returns same data.
To implement this function, you need a Platform board and Wi-Fi board. Below are what we used.
- WIZwiki-W7500 from WIZnet (Platform board)
- WizFi310 from WIZnet (Wi-Fi board)
WIZwiki-W7500 Pin map

- D0 is for RXD, D1 is for TXD
 
- D6 is for CTS, D7 is for RTS
- D9 is for RESET  
 
WizFi310 Pin map
 
 
- J1 is for RXD, J3 is for TXD
 
- SW6-1 is connected to D6 for RTS, SW6-2 is connected to D7 for CTS
 
- SW5-3 is connected to D9 for RESET  
 
Software
Connect to Wi-Fi
wifi.connect(AP_SSID, AP_PASSWORD, AP_SECURITY);
Get information
const char *ip = wifi.get_ip_address(); const char *mac = wifi.get_mac_address();
Receive data and return to TCP client
while (true)
{
    int n = clt_sock.recv(buffer, sizeof(buffer));
    if( n < 0 )
    {
        clt_sock.close();
        srv.close();
    }
    if( n > 0 )
    {
        buffer[n] = '\0';
        printf("length : %d\r\n", n);
        clt_sock.send(buffer, n);
    }
}
Caution
TCP client and server should be in a same network.
Changes
| Revision | Date | Who | Commit message | 
|---|---|---|---|
| 1:5981ba4a8323 | 2017-04-18 | stkim92 | revise Code description (TCP client -> server) | 
| 0:50932ef4b276 | 2017-04-17 | kaizen | Added TCP Echo Server Example using WizFi310 |