// main for tcp ip stack #define THIS_IS_STACK_APPLICATION #include "StackTsk.h" #include "tick.h" #include "Tcp.h" APP_CONFIG AppConfig; int global_network_int; char global_network_char; void network_send_hello( unsigned char termid) { switch(TCB[0].smState) { case SM_CONNECT: Sock = TCPConnect(, 1234); if( Sock == INVALID_SOCKET ){ return 1; } else smState = SM_CONNECT_WAIT; return; case SM_CONNECT_WAIT: if( TCPISConnected(Sock) ){ smState = SM_CONNECTED; } return; } } void main() { TickInit(); StackInit(); // tcp,ud,mac,arp Init happends in StackInit(); while(1) { TickUpdate(); StackTask(); TCPTick(); } }