﻿<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://www.yfrobot.com.cn/wiki/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
		<id>https://www.yfrobot.com.cn/wiki/index.php?action=history&amp;feed=atom&amp;title=Cores%3AUdp.h</id>
		<title>Cores:Udp.h - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="https://www.yfrobot.com.cn/wiki/index.php?action=history&amp;feed=atom&amp;title=Cores%3AUdp.h"/>
		<link rel="alternate" type="text/html" href="https://www.yfrobot.com.cn/wiki/index.php?title=Cores:Udp.h&amp;action=history"/>
		<updated>2026-05-07T02:07:35Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.22.6</generator>

	<entry>
		<id>https://www.yfrobot.com.cn/wiki/index.php?title=Cores:Udp.h&amp;diff=331&amp;oldid=prev</id>
		<title>Admin：以“&lt;font color=&quot;quartz&quot; size =&quot;+2&quot;&gt; '''Udp.h''' &lt;/font&gt;  &lt;pre style=&quot;color:royalblue&quot;&gt; /*  *  Udp.cpp: Library to send/receive UDP packets.  *  * NOTE: UDP is fast, but...”为内容创建页面</title>
		<link rel="alternate" type="text/html" href="https://www.yfrobot.com.cn/wiki/index.php?title=Cores:Udp.h&amp;diff=331&amp;oldid=prev"/>
				<updated>2015-07-10T11:36:55Z</updated>
		
		<summary type="html">&lt;p&gt;以“&amp;lt;font color=&amp;quot;quartz&amp;quot; size =&amp;quot;+2&amp;quot;&amp;gt; &amp;#039;&amp;#039;&amp;#039;Udp.h&amp;#039;&amp;#039;&amp;#039; &amp;lt;/font&amp;gt;  &amp;lt;pre style=&amp;quot;color:royalblue&amp;quot;&amp;gt; /*  *  Udp.cpp: Library to send/receive UDP packets.  *  * NOTE: UDP is fast, but...”为内容创建页面&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;font color=&amp;quot;quartz&amp;quot; size =&amp;quot;+2&amp;quot;&amp;gt; '''Udp.h''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:royalblue&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 *  Udp.cpp: Library to send/receive UDP packets.&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these)&lt;br /&gt;
 * 1) UDP does not guarantee the order in which assembled UDP packets are received. This&lt;br /&gt;
 * might not happen often in practice, but in larger network topologies, a UDP&lt;br /&gt;
 * packet can be received out of sequence. &lt;br /&gt;
 * 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being&lt;br /&gt;
 * aware of it. Again, this may not be a concern in practice on small local networks.&lt;br /&gt;
 * For more information, see http://www.cafeaulait.org/course/week12/35.html&lt;br /&gt;
 *&lt;br /&gt;
 * MIT License:&lt;br /&gt;
 * Copyright (c) 2008 Bjoern Hartmann&lt;br /&gt;
 * Permission is hereby granted, free of charge, to any person obtaining a copy&lt;br /&gt;
 * of this software and associated documentation files (the &amp;quot;Software&amp;quot;), to deal&lt;br /&gt;
 * in the Software without restriction, including without limitation the rights&lt;br /&gt;
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell&lt;br /&gt;
 * copies of the Software, and to permit persons to whom the Software is&lt;br /&gt;
 * furnished to do so, subject to the following conditions:&lt;br /&gt;
 * &lt;br /&gt;
 * The above copyright notice and this permission notice shall be included in&lt;br /&gt;
 * all copies or substantial portions of the Software.&lt;br /&gt;
 * &lt;br /&gt;
 * THE SOFTWARE IS PROVIDED &amp;quot;AS IS&amp;quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR&lt;br /&gt;
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,&lt;br /&gt;
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE&lt;br /&gt;
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER&lt;br /&gt;
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,&lt;br /&gt;
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN&lt;br /&gt;
 * THE SOFTWARE.&lt;br /&gt;
 *&lt;br /&gt;
 * bjoern@cs.stanford.edu 12/30/2008&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
#ifndef udp_h&lt;br /&gt;
#define udp_h&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;Stream.h&amp;gt;&lt;br /&gt;
#include &amp;lt;IPAddress.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class UDP : public Stream {&lt;br /&gt;
&lt;br /&gt;
public:&lt;br /&gt;
  virtual uint8_t begin(uint16_t) =0;	// initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use&lt;br /&gt;
  virtual void stop() =0;  // Finish with the UDP socket&lt;br /&gt;
&lt;br /&gt;
  // Sending UDP packets&lt;br /&gt;
  &lt;br /&gt;
  // Start building up a packet to send to the remote host specific in ip and port&lt;br /&gt;
  // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port&lt;br /&gt;
  virtual int beginPacket(IPAddress ip, uint16_t port) =0;&lt;br /&gt;
  // Start building up a packet to send to the remote host specific in host and port&lt;br /&gt;
  // Returns 1 if successful, 0 if there was a problem resolving the hostname or port&lt;br /&gt;
  virtual int beginPacket(const char *host, uint16_t port) =0;&lt;br /&gt;
  // Finish off this packet and send it&lt;br /&gt;
  // Returns 1 if the packet was sent successfully, 0 if there was an error&lt;br /&gt;
  virtual int endPacket() =0;&lt;br /&gt;
  // Write a single byte into the packet&lt;br /&gt;
  virtual size_t write(uint8_t) =0;&lt;br /&gt;
  // Write size bytes from buffer into the packet&lt;br /&gt;
  virtual size_t write(const uint8_t *buffer, size_t size) =0;&lt;br /&gt;
&lt;br /&gt;
  // Start processing the next available incoming packet&lt;br /&gt;
  // Returns the size of the packet in bytes, or 0 if no packets are available&lt;br /&gt;
  virtual int parsePacket() =0;&lt;br /&gt;
  // Number of bytes remaining in the current packet&lt;br /&gt;
  virtual int available() =0;&lt;br /&gt;
  // Read a single byte from the current packet&lt;br /&gt;
  virtual int read() =0;&lt;br /&gt;
  // Read up to len bytes from the current packet and place them into buffer&lt;br /&gt;
  // Returns the number of bytes read, or 0 if none are available&lt;br /&gt;
  virtual int read(unsigned char* buffer, size_t len) =0;&lt;br /&gt;
  // Read up to len characters from the current packet and place them into buffer&lt;br /&gt;
  // Returns the number of characters read, or 0 if none are available&lt;br /&gt;
  virtual int read(char* buffer, size_t len) =0;&lt;br /&gt;
  // Return the next byte from the current packet without moving on to the next byte&lt;br /&gt;
  virtual int peek() =0;&lt;br /&gt;
  virtual void flush() =0;	// Finish reading the current packet&lt;br /&gt;
&lt;br /&gt;
  // Return the IP address of the host who sent the current incoming packet&lt;br /&gt;
  virtual IPAddress remoteIP() =0;&lt;br /&gt;
  // Return the port of the host who sent the current incoming packet&lt;br /&gt;
  virtual uint16_t remotePort() =0;&lt;br /&gt;
protected:&lt;br /&gt;
  uint8_t* rawIPAddress(IPAddress&amp;amp; addr) { return addr.raw_address(); };&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Arduino核心代码|返回核心代码首页]]&lt;br /&gt;
&lt;br /&gt;
更多建议和问题欢迎反馈至 [http://www.yfrobot.com YFRobot论坛]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>