|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2010-6-22 09:23:17
|
显示全部楼层
/* 线程入口 */
void lw_thread(void* paramter)
{
struct netconn *conn, *newconn;
/* 建立一个新的TCP连接句柄 */
conn = netconn_new(NETCONN_TCP);
/* 将连接绑定在任意的本地IP地址的80端口上 */
netconn_bind(conn, NULL, 80);
/* 连接进入监听状态 */
netconn_listen(conn);
/* 循环处理 */
while(1)
{
/* 接受新的连接请求 */
newconn = netconn_accept(conn);
/* 处理进入的连接 */
process_connection(newconn);
/* 删除连接句柄 */
netconn_delete(newconn);
}
}
int rt_application_init()
{
rt_thread_t init_thread;
init_thread = rt_thread_create("init",
rt_init_thread_entry, RT_NULL,
1024, 21, 20);
rt_thread_startup(init_thread);
init_thread = rt_thread_create("my_task",
my_task, RT_NULL,
1024, 20, 20);
rt_thread_startup(init_thread);
init_thread = rt_thread_create("lwip",
lw_thread, RT_NULL,
2048, 22, 20);
rt_thread_startup(init_thread);
return 0;
} |
|