23 lines
520 B
C
23 lines
520 B
C
#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 |