Files
ETH_TCP_Demo/app/tcp_server.h
2026-03-04 08:50:04 +08:00

36 lines
878 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* tcp_server.h
*
* Created on: 2026-03-03
* Author: RT-Thread
*
* 功能: TCP服务器模块
* 依赖: lwIP网络栈、SHT40传感器
* 跨平台适配: 基于RT-Thread Nano使用标准lwIP API
*/
#ifndef TCP_SERVER_H
#define TCP_SERVER_H
#include "lwip/sockets.h"
/* TCP Server Configuration */
#define TCP_SERVER_PORT 5588
#define TCP_SERVER_MAX_CLIENTS 2
#define TCP_SERVER_HEARTBEAT_INTERVAL 500 // 心跳间隔 500ms
#define TCP_SERVER_RECEIVE_TIMEOUT 5000 // 接收超时 5 秒
/* 客户端连接结构 */
typedef struct {
int sock; /* 客户端socket */
struct sockaddr_in addr; /* 客户端地址 */
int connected; /* 连接状态 */
} client_conn_t;
/* 全局标志 */
extern volatile int data_upload_success;
/* 函数声明 */
void tcp_server_entry(void *parameter);
#endif /* TCP_SERVER_H */