
SDK Programming Guide Version 1.511
ABLELink
R
Ethernet-Serial Server MAXI Series
APPENDIX C
:
SAMPLE PROGRAM
C.1 TCP/IP sample program
/*-------------------------------------------------------------------------------------------------------
This is a TCP sample program for GW21x-MAXI.
*This program do following things:
1. Listen a TCP port = 4660.
2. After connection ok, echo a message:
"Hello, this is GW21 series".
3. After receiving data, it will prompt a message and echo the received data.
For example: Receiving a 'A', then it will echo the message:
"Hello, I receive data =A"
4. If disconnected, it will listen again automatically.
*You can use the 'telnet' utility to test this sample program
--------------------------------------------------------------------------------------------------------*/
#include "tcpdef.h"
#include "tcpapi.h"
#include "dapapi.h"
#define _OK
0
#define _ERR 1
#define DEF_MSS 512
#define MY_PORT 0x1234
#define NULL_ARG (char far *)0
int handle;
int connect_f = _ERR ;
int recv_f = _ERR ;
int send_f = _ERR ;
unsigned char recvbuf[DEF_MSS];
Copyright © 2004 Atop Technologies, Inc.
All rights reserved. Designed in Taiwan.