server/client

Dependencies:   mbed NetServicesMin

main.cpp

Committer:
recotana
Date:
2012-02-19
Revision:
0:432b571e11a3
Child:
1:6e61ee662fd3

File content as of revision 0:432b571e11a3:

#include "mbed.h"
#include "EthernetNetIf.h"
#include "config.h"
#include "tcp_server.h"
#include "tcp_client.h"

EthernetNetIf eth ;   

Ticker connectCheck;
 
int main() {


    EthernetNetIf eth( //)  -- static IP address 
        IpAddr(kSserverIp),     // IP Address
        IpAddr(kSubnetMask),   // Subnet Mask
        IpAddr(kRouterIp),     // Default Gateway
        IpAddr(kRouterIp)      // DNS Server
    ) ;

    if( eth.setup() != ETH_OK )
    {
        printf("Ether Setup Error\r\n");
        return -1;
    }
    printf("Setup OK\r\n");

    IpAddr ip = eth.getIp() ;
    printf("mbed IP Address is [%d.%d.%d.%d]\r\n", ip[0], ip[1], ip[2], ip[3]) ;

    serverInit();
    
    clientInit();
    connectCheckStart( IpAddr(kClientIp),kClientPort );

    while(1) {
        Net::poll();
    }
}