Sending Data to the Server
• ที่นี่ฉันได้สร้าง a
periodic timer อีกด้วย, ซึ่งจะทไให้เกิด an interrupt ทุกๆ 1 second.
• The data จะส่งถึง the server ใน the timer callback, และดังนั้นทุกๆ 1 second.
• เพื่อส่ง the data ไปยัง the server, ก่อนอื่นเราจะสร้าง a packet buffer,
txBuf • จากนั้นเราจะ
จัดสรร the memory สำหรับ packet buffer นี้
•
pbuf_take จะถูกใช้เพื่อคัดลอก the data ลงใน the packet buffer.
• และสุดท้ายเราจะส่ง the data โดยใช้ the
udp_send function.