pile_com_stm32/main/communication_pad/inc/udp_server.h
2024-04-25 10:20:39 +08:00

23 lines
520 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.

#ifndef __UDP_SERVER_H
#define __UDP_SERVER_H
#include <stdint.h>
#include "lwip/ip_addr.h"
#define UDP_SERVER_PORT 6000
#define UDP_NOTIFY_TIMEOUT (60 * 5) // 200ms notify一次5s超时
// 链表,记录连接的客户端
struct clientNode
{
struct udp_pcb *upcb;
ip_addr_t addr;
uint16_t port;
int notify_timeout; // 上报数据的超时时间,客户端需定期发送上报请求
struct clientNode *next;
};
void udp_server_init(void);
void udp_server_notify(uint8_t *data, int len);
#endif