MediaTek LinkIt™ Connect 7681 Developer's Guide
© 2015, 2016 MediaTek Inc.
Page 47 of 65
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.
The shell window at the remote server will start displaying “hello” periodically. You can also type
characters back, these should be output on UART of MT7681.
5.3.2.
Create a TCP server and allow others to connect
This section describes how to create a TCP server, listen to a port and exchange data with a
connection to that port.
1)
Listening to the Port
Use
uip_listen()
to listen on a specified port. The following code listens to port 9999:
File: iot_tcp_app.c
void
app_init_connection
(
void
)
{
uip_listen
(
HTONS
(
9999
));
}
void
iot_tcp_app_init
(
void
)
{
...
app_init_connection
();
}