This program shows how to use TLS_cyassl to connect to mbed.org

Dependencies:   EthernetInterface6 TLS_cyassl mbed-rtos mbed

Fork of TLS_cyassl-Example by Francois Berder

main.cpp

Committer:
feb11
Date:
2013-09-18
Revision:
2:a223b3c8a334
Parent:
1:a5e7369f39d9

File content as of revision 2:a223b3c8a334:

/** This example show how to use the TLS_cyassl library
    to connect to a server using TLS.
*/

#include "mbed.h"
#include "EthernetInterface.h"
#include "TLSConnection.h"
#include "TLSServer.h"

const char host[] = "mbed.org";

int main() 
{
    set_time(1379062044);
    EthernetInterface eth;
    if(eth.init() || eth.connect())
    {
        printf("Error with EthernetInterface\n\r");
        return -1;
    }
    
    TLSConnection con;
    if(!con.connect(host))
    {
        printf("Failed to connect to %s\n", host);
    }
    else
    {
        printf("Connected to %s\n !", host); 
        con.close();   
    }
    
    eth.disconnect();
    
    return 0;
}