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.
49 lines
1014 B
49 lines
1014 B
/*
|
|
* 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 8
|
|
|
|
// 客户端连接结构
|
|
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);
|
|
|
|
typedef struct SendDataNode
|
|
{
|
|
uint8_t Tx_Buf[255]; /*发送数据*/
|
|
uint8_t Tx_Count; /*学号*/
|
|
struct SendDataNode * next; /*指向下一个节点的指针*/
|
|
}SendDataNode;
|
|
extern void tcp_add_sendList(uint8_t *tx_Buf, uint8_t tx_count);
|
|
|
|
|
|
|
|
|
|
//#endif /* TCP_SERVER_H */
|
|
|
|
|
|
#endif /* BASE_INC_BSP_TCP_SERVER_H_ */
|
|
|