You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
742 B
39 lines
742 B
|
2 weeks ago
|
/*
|
||
|
|
* bsp_TCPServer.h
|
||
|
|
*
|
||
|
|
* Created on: 2025年8月4日
|
||
|
|
* Author: akeguo
|
||
|
|
*/
|
||
|
|
|
||
|
|
#ifndef BASE_INC_BSP_TCP_SERVER_H_
|
||
|
|
#define BASE_INC_BSP_TCP_SERVER_H_
|
||
|
|
|
||
|
|
//#ifndef TCP_SERVER_H
|
||
|
|
//#define TCP_SERVER_H
|
||
|
|
|
||
|
|
#include "lwip/tcp.h"
|
||
|
|
#include <stdint.h>
|
||
|
|
|
||
|
|
// 最大客户端连接数
|
||
|
|
#define MAX_CLIENTS 3
|
||
|
|
|
||
|
|
// 客户端连接结构
|
||
|
|
typedef struct {
|
||
|
|
struct tcp_pcb *pcb; // LwIP PCB指针
|
||
|
|
uint8_t active; // 连接是否活跃
|
||
|
|
} client_conn_t;
|
||
|
|
|
||
|
|
// 服务器初始化
|
||
|
|
void tcp_server_init(uint16_t port);
|
||
|
|
|
||
|
|
// 发送数据给所有客户端
|
||
|
|
void tcp_send_to_all_clients(const char *data, uint16_t len);
|
||
|
|
|
||
|
|
// 定时器回调声明
|
||
|
|
void tcp_server_timer_callback(void);
|
||
|
|
|
||
|
|
//#endif /* TCP_SERVER_H */
|
||
|
|
|
||
|
|
|
||
|
|
#endif /* BASE_INC_BSP_TCP_SERVER_H_ */
|