Mediatek Labs LinkIt Connect 7681 Developer's Manual page 50

Table of Contents

Advertisement

5.3.1.
Creating a TCP client that connects to a remote TCP server
This section describes how to create a TCP client, connect to a remote TCP server and exchange
data with that remote server.
1)
Initialize the connection
Use uip_connect() to create the connection. In the example below, a connection to port
9999 of 192.168.1.1 with the local port is set as 8888 is defined:
File: iot_tcp_app.c
void
app_init_connection(void)
{
UIP_CONN
uip_ipaddr_t
UINT8
uip_ipaddr(raddr, iot_srv_ip[0],iot_srv_ip[1],
iot_srv_ip[2],iot_srv_ip[3]);
/* Specify remote address and port here. */
tcp_conn
if(tcp_conn) {
tcp_conn->lport
}
else
printf_high("connect
}
}
This step can be actioned at any time, including before MT7681 has connected to a wireless
network.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
MediaTek LinkIt™ Connect 7681 Developer's Guide
*tcp_conn=NULL;
raddr;
iot_srv_ip[MAC_IP_LEN] =
= uip_connect(&raddr, HTONS(9999));
= HTONS(8888);
{
© 2015, 2016 MediaTek Inc.
{192, 168, 1,
fail\n");
1};
Page 45 of 65

Advertisement

Table of Contents
loading

Related Products for Mediatek Labs LinkIt Connect 7681

Table of Contents