292 lines
No EOL
36 KiB
HTML
292 lines
No EOL
36 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<meta name="generator" content="rustdoc">
|
||
<meta name="description" content="API documentation for the Rust `UdpSocket` struct in crate `bitflags`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, UdpSocket">
|
||
|
||
<title>bitflags::__core::net::UdpSocket - Rust</title>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../../../rustdoc.css">
|
||
<link rel="stylesheet" type="text/css" href="../../../main.css">
|
||
|
||
|
||
|
||
|
||
</head>
|
||
<body class="rustdoc">
|
||
<!--[if lte IE 8]>
|
||
<div class="warning">
|
||
This old browser is unsupported and will most likely display funky
|
||
things.
|
||
</div>
|
||
<![endif]-->
|
||
|
||
|
||
|
||
<nav class="sidebar">
|
||
|
||
<p class='location'><a href='../../index.html'>bitflags</a>::<wbr><a href='../index.html'>__core</a>::<wbr><a href='index.html'>net</a></p><script>window.sidebarCurrent = {name: 'UdpSocket', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
|
||
</nav>
|
||
|
||
<nav class="sub">
|
||
<form class="search-form js-only">
|
||
<div class="search-container">
|
||
<input class="search-input" name="search"
|
||
autocomplete="off"
|
||
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
||
type="search">
|
||
</div>
|
||
</form>
|
||
</nav>
|
||
|
||
<section id='main' class="content struct">
|
||
<h1 class='fqn'><span class='in-band'>Struct <a href='../../index.html'>bitflags</a>::<wbr><a href='../index.html'>__core</a>::<wbr><a href='index.html'>net</a>::<wbr><a class='struct' href=''>UdpSocket</a></span><span class='out-of-band'><span id='render-detail'>
|
||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||
[<span class='inner'>−</span>]
|
||
</a>
|
||
</span><a id='src-5937' class='srclink' href='https://doc.rust-lang.org/nightly/std/net/udp/struct.UdpSocket.html?gotosrc=5937' title='goto source code'>[src]</a></span></h1>
|
||
<pre class='rust struct'>pub struct UdpSocket(_);</pre><span class="since">1.0.0</span><div class='docblock'><p>A User Datagram Protocol socket.</p>
|
||
|
||
<p>This is an implementation of a bound UDP socket. This supports both IPv4 and
|
||
IPv6 addresses, and there is no corresponding notion of a server because UDP
|
||
is a datagram protocol.</p>
|
||
|
||
<h1 id='examples' class='section-header'><a href='#examples'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>net</span>::<span class='ident'>UdpSocket</span>;
|
||
|
||
{
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>socket</span> <span class='op'>=</span> <span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>UdpSocket</span>::<span class='ident'>bind</span>(<span class='string'>"127.0.0.1:34254"</span>));
|
||
|
||
<span class='comment'>// read from the socket</span>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>buf</span> <span class='op'>=</span> [<span class='number'>0</span>; <span class='number'>10</span>];
|
||
<span class='kw'>let</span> (<span class='ident'>amt</span>, <span class='ident'>src</span>) <span class='op'>=</span> <span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>socket</span>.<span class='ident'>recv_from</span>(<span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='ident'>buf</span>));
|
||
|
||
<span class='comment'>// send a reply to the socket we received data from</span>
|
||
<span class='kw'>let</span> <span class='ident'>buf</span> <span class='op'>=</span> <span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='ident'>buf</span>[..<span class='ident'>amt</span>];
|
||
<span class='ident'>buf</span>.<span class='ident'>reverse</span>();
|
||
<span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>socket</span>.<span class='ident'>send_to</span>(<span class='ident'>buf</span>, <span class='kw-2'>&</span><span class='ident'>src</span>));
|
||
} <span class='comment'>// the socket is closed here</span></pre>
|
||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><code>impl <a class='struct' href='../../../bitflags/__core/net/struct.UdpSocket.html' title='bitflags::__core::net::UdpSocket'>UdpSocket</a></code></h3><div class='impl-items'><h4 id='method.bind' class='method'><code>fn <a href='#method.bind' class='fnname'>bind</a><A>(addr: A) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='struct' href='../../../bitflags/__core/net/struct.UdpSocket.html' title='bitflags::__core::net::UdpSocket'>UdpSocket</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>> <span class='where'>where A: <a class='trait' href='../../../bitflags/__core/net/trait.ToSocketAddrs.html' title='bitflags::__core::net::ToSocketAddrs'>ToSocketAddrs</a></span></code></h4>
|
||
<div class='docblock'><p>Creates a UDP socket from the given address.</p>
|
||
|
||
<p>The address type can be any implementor of <code>ToSocketAddr</code> trait. See
|
||
its documentation for concrete examples.</p>
|
||
</div><h4 id='method.recv_from' class='method'><code>fn <a href='#method.recv_from' class='fnname'>recv_from</a>(&self, buf: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>&mut [</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u8.html'>u8</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>]</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>(</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.usize.html'>usize</a>, <a class='enum' href='../../../bitflags/__core/net/enum.SocketAddr.html' title='bitflags::__core::net::SocketAddr'>SocketAddr</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>)</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code></h4>
|
||
<div class='docblock'><p>Receives data from the socket. On success, returns the number of bytes
|
||
read and the address from whence the data came.</p>
|
||
</div><h4 id='method.send_to' class='method'><code>fn <a href='#method.send_to' class='fnname'>send_to</a><A>(&self, buf: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>&[</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u8.html'>u8</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>]</a>, addr: A) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.usize.html'>usize</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>> <span class='where'>where A: <a class='trait' href='../../../bitflags/__core/net/trait.ToSocketAddrs.html' title='bitflags::__core::net::ToSocketAddrs'>ToSocketAddrs</a></span></code></h4>
|
||
<div class='docblock'><p>Sends data on the socket to the given address. On success, returns the
|
||
number of bytes written.</p>
|
||
|
||
<p>Address type can be any implementor of <code>ToSocketAddrs</code> trait. See its
|
||
documentation for concrete examples.</p>
|
||
</div><h4 id='method.local_addr' class='method'><code>fn <a href='#method.local_addr' class='fnname'>local_addr</a>(&self) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='enum' href='../../../bitflags/__core/net/enum.SocketAddr.html' title='bitflags::__core::net::SocketAddr'>SocketAddr</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code></h4>
|
||
<div class='docblock'><p>Returns the socket address that this socket was created from.</p>
|
||
</div><h4 id='method.try_clone' class='method'><code>fn <a href='#method.try_clone' class='fnname'>try_clone</a>(&self) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='struct' href='../../../bitflags/__core/net/struct.UdpSocket.html' title='bitflags::__core::net::UdpSocket'>UdpSocket</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code></h4>
|
||
<div class='docblock'><p>Creates a new independently owned handle to the underlying socket.</p>
|
||
|
||
<p>The returned <code>UdpSocket</code> is a reference to the same socket that this
|
||
object references. Both handles will read and write the same port, and
|
||
options set on one socket will be propagated to the other.</p>
|
||
</div><h4 id='method.set_read_timeout' class='method'><code>fn <a href='#method.set_read_timeout' class='fnname'>set_read_timeout</a>(&self, dur: <a class='enum' href='../../../bitflags/__core/option/enum.Option.html' title='bitflags::__core::option::Option'>Option</a><<a class='struct' href='../../../bitflags/__core/time/struct.Duration.html' title='bitflags::__core::time::Duration'>Duration</a>>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>()</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.4.0</span></h4>
|
||
<div class='docblock'><p>Sets the read timeout to the timeout specified.</p>
|
||
|
||
<p>If the value specified is <code>None</code>, then <code>read</code> calls will block
|
||
indefinitely. It is an error to pass the zero <code>Duration</code> to this
|
||
method.</p>
|
||
|
||
<h1 id='note' class='section-header'><a href='#note'>Note</a></h1>
|
||
<p>Platforms may return a different error code whenever a read times out as
|
||
a result of setting this option. For example Unix typically returns an
|
||
error of the kind <code>WouldBlock</code>, but Windows may return <code>TimedOut</code>.</p>
|
||
</div><h4 id='method.set_write_timeout' class='method'><code>fn <a href='#method.set_write_timeout' class='fnname'>set_write_timeout</a>(&self, dur: <a class='enum' href='../../../bitflags/__core/option/enum.Option.html' title='bitflags::__core::option::Option'>Option</a><<a class='struct' href='../../../bitflags/__core/time/struct.Duration.html' title='bitflags::__core::time::Duration'>Duration</a>>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>()</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.4.0</span></h4>
|
||
<div class='docblock'><p>Sets the write timeout to the timeout specified.</p>
|
||
|
||
<p>If the value specified is <code>None</code>, then <code>write</code> calls will block
|
||
indefinitely. It is an error to pass the zero <code>Duration</code> to this
|
||
method.</p>
|
||
|
||
<h1 id='note-1' class='section-header'><a href='#note-1'>Note</a></h1>
|
||
<p>Platforms may return a different error code whenever a write times out
|
||
as a result of setting this option. For example Unix typically returns
|
||
an error of the kind <code>WouldBlock</code>, but Windows may return <code>TimedOut</code>.</p>
|
||
</div><h4 id='method.read_timeout' class='method'><code>fn <a href='#method.read_timeout' class='fnname'>read_timeout</a>(&self) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='enum' href='../../../bitflags/__core/option/enum.Option.html' title='bitflags::__core::option::Option'>Option</a><<a class='struct' href='../../../bitflags/__core/time/struct.Duration.html' title='bitflags::__core::time::Duration'>Duration</a>>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.4.0</span></h4>
|
||
<div class='docblock'><p>Returns the read timeout of this socket.</p>
|
||
|
||
<p>If the timeout is <code>None</code>, then <code>read</code> calls will block indefinitely.</p>
|
||
</div><h4 id='method.write_timeout' class='method'><code>fn <a href='#method.write_timeout' class='fnname'>write_timeout</a>(&self) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='enum' href='../../../bitflags/__core/option/enum.Option.html' title='bitflags::__core::option::Option'>Option</a><<a class='struct' href='../../../bitflags/__core/time/struct.Duration.html' title='bitflags::__core::time::Duration'>Duration</a>>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.4.0</span></h4>
|
||
<div class='docblock'><p>Returns the write timeout of this socket.</p>
|
||
|
||
<p>If the timeout is <code>None</code>, then <code>write</code> calls will block indefinitely.</p>
|
||
</div><h4 id='method.set_broadcast' class='method'><code>fn <a href='#method.set_broadcast' class='fnname'>set_broadcast</a>(&self, broadcast: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.bool.html'>bool</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>()</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Sets the value of the <code>SO_BROADCAST</code> option for this socket.</p>
|
||
|
||
<p>When enabled, this socket is allowed to send packets to a broadcast
|
||
address.</p>
|
||
</div><h4 id='method.broadcast' class='method'><code>fn <a href='#method.broadcast' class='fnname'>broadcast</a>(&self) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.bool.html'>bool</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Gets the value of the <code>SO_BROADCAST</code> option for this socket.</p>
|
||
|
||
<p>For more information about this option, see
|
||
<a href="#method.set_broadcast"><code>set_broadcast</code></a>.</p>
|
||
</div><h4 id='method.set_multicast_loop_v4' class='method'><code>fn <a href='#method.set_multicast_loop_v4' class='fnname'>set_multicast_loop_v4</a>(&self, multicast_loop_v4: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.bool.html'>bool</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>()</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Sets the value of the <code>IP_MULTICAST_LOOP</code> option for this socket.</p>
|
||
|
||
<p>If enabled, multicast packets will be looped back to the local socket.
|
||
Note that this may not have any affect on IPv6 sockets.</p>
|
||
</div><h4 id='method.multicast_loop_v4' class='method'><code>fn <a href='#method.multicast_loop_v4' class='fnname'>multicast_loop_v4</a>(&self) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.bool.html'>bool</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Gets the value of the <code>IP_MULTICAST_LOOP</code> option for this socket.</p>
|
||
|
||
<p>For more information about this option, see
|
||
<a href="#method.set_multicast_loop_v4"><code>set_multicast_loop_v4</code></a>.</p>
|
||
</div><h4 id='method.set_multicast_ttl_v4' class='method'><code>fn <a href='#method.set_multicast_ttl_v4' class='fnname'>set_multicast_ttl_v4</a>(&self, multicast_ttl_v4: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u32.html'>u32</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>()</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Sets the value of the <code>IP_MULTICAST_TTL</code> option for this socket.</p>
|
||
|
||
<p>Indicates the time-to-live value of outgoing multicast packets for
|
||
this socket. The default value is 1 which means that multicast packets
|
||
don't leave the local network unless explicitly requested.</p>
|
||
|
||
<p>Note that this may not have any affect on IPv6 sockets.</p>
|
||
</div><h4 id='method.multicast_ttl_v4' class='method'><code>fn <a href='#method.multicast_ttl_v4' class='fnname'>multicast_ttl_v4</a>(&self) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u32.html'>u32</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Gets the value of the <code>IP_MULTICAST_TTL</code> option for this socket.</p>
|
||
|
||
<p>For more information about this option, see
|
||
<a href="#method.set_multicast_ttl_v4"><code>set_multicast_ttl_v4</code></a>.</p>
|
||
</div><h4 id='method.set_multicast_loop_v6' class='method'><code>fn <a href='#method.set_multicast_loop_v6' class='fnname'>set_multicast_loop_v6</a>(&self, multicast_loop_v6: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.bool.html'>bool</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>()</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Sets the value of the <code>IPV6_MULTICAST_LOOP</code> option for this socket.</p>
|
||
|
||
<p>Controls whether this socket sees the multicast packets it sends itself.
|
||
Note that this may not have any affect on IPv4 sockets.</p>
|
||
</div><h4 id='method.multicast_loop_v6' class='method'><code>fn <a href='#method.multicast_loop_v6' class='fnname'>multicast_loop_v6</a>(&self) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.bool.html'>bool</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Gets the value of the <code>IPV6_MULTICAST_LOOP</code> option for this socket.</p>
|
||
|
||
<p>For more information about this option, see
|
||
<a href="#method.set_multicast_loop_v6"><code>set_multicast_loop_v6</code></a>.</p>
|
||
</div><h4 id='method.set_ttl' class='method'><code>fn <a href='#method.set_ttl' class='fnname'>set_ttl</a>(&self, ttl: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u32.html'>u32</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>()</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Sets the value for the <code>IP_TTL</code> option on this socket.</p>
|
||
|
||
<p>This value sets the time-to-live field that is used in every packet sent
|
||
from this socket.</p>
|
||
</div><h4 id='method.ttl' class='method'><code>fn <a href='#method.ttl' class='fnname'>ttl</a>(&self) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u32.html'>u32</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Gets the value of the <code>IP_TTL</code> option for this socket.</p>
|
||
|
||
<p>For more information about this option, see <a href="#method.set_ttl"><code>set_ttl</code></a>.</p>
|
||
</div><h4 id='method.join_multicast_v4' class='method'><code>fn <a href='#method.join_multicast_v4' class='fnname'>join_multicast_v4</a>(&self, multiaddr: &<a class='struct' href='../../../bitflags/__core/net/struct.Ipv4Addr.html' title='bitflags::__core::net::Ipv4Addr'>Ipv4Addr</a>, interface: &<a class='struct' href='../../../bitflags/__core/net/struct.Ipv4Addr.html' title='bitflags::__core::net::Ipv4Addr'>Ipv4Addr</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>()</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Executes an operation of the <code>IP_ADD_MEMBERSHIP</code> type.</p>
|
||
|
||
<p>This function specifies a new multicast group for this socket to join.
|
||
The address must be a valid multicast address, and <code>interface</code> is the
|
||
address of the local interface with which the system should join the
|
||
multicast group. If it's equal to <code>INADDR_ANY</code> then an appropriate
|
||
interface is chosen by the system.</p>
|
||
</div><h4 id='method.join_multicast_v6' class='method'><code>fn <a href='#method.join_multicast_v6' class='fnname'>join_multicast_v6</a>(&self, multiaddr: &<a class='struct' href='../../../bitflags/__core/net/struct.Ipv6Addr.html' title='bitflags::__core::net::Ipv6Addr'>Ipv6Addr</a>, interface: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u32.html'>u32</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>()</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Executes an operation of the <code>IPV6_ADD_MEMBERSHIP</code> type.</p>
|
||
|
||
<p>This function specifies a new multicast group for this socket to join.
|
||
The address must be a valid multicast address, and <code>interface</code> is the
|
||
index of the interface to join/leave (or 0 to indicate any interface).</p>
|
||
</div><h4 id='method.leave_multicast_v4' class='method'><code>fn <a href='#method.leave_multicast_v4' class='fnname'>leave_multicast_v4</a>(&self, multiaddr: &<a class='struct' href='../../../bitflags/__core/net/struct.Ipv4Addr.html' title='bitflags::__core::net::Ipv4Addr'>Ipv4Addr</a>, interface: &<a class='struct' href='../../../bitflags/__core/net/struct.Ipv4Addr.html' title='bitflags::__core::net::Ipv4Addr'>Ipv4Addr</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>()</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Executes an operation of the <code>IP_DROP_MEMBERSHIP</code> type.</p>
|
||
|
||
<p>For more information about this option, see
|
||
<a href="#method.join_multicast_v4"><code>join_multicast_v4</code></a>.</p>
|
||
</div><h4 id='method.leave_multicast_v6' class='method'><code>fn <a href='#method.leave_multicast_v6' class='fnname'>leave_multicast_v6</a>(&self, multiaddr: &<a class='struct' href='../../../bitflags/__core/net/struct.Ipv6Addr.html' title='bitflags::__core::net::Ipv6Addr'>Ipv6Addr</a>, interface: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u32.html'>u32</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>()</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Executes an operation of the <code>IPV6_DROP_MEMBERSHIP</code> type.</p>
|
||
|
||
<p>For more information about this option, see
|
||
<a href="#method.join_multicast_v6"><code>join_multicast_v6</code></a>.</p>
|
||
</div><h4 id='method.take_error' class='method'><code>fn <a href='#method.take_error' class='fnname'>take_error</a>(&self) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='enum' href='../../../bitflags/__core/option/enum.Option.html' title='bitflags::__core::option::Option'>Option</a><<a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Get the value of the <code>SO_ERROR</code> option on this socket.</p>
|
||
|
||
<p>This will retrieve the stored error in the underlying socket, clearing
|
||
the field in the process. This can be useful for checking errors between
|
||
calls.</p>
|
||
</div><h4 id='method.connect' class='method'><code>fn <a href='#method.connect' class='fnname'>connect</a><A>(&self, addr: A) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>()</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>> <span class='where'>where A: <a class='trait' href='../../../bitflags/__core/net/trait.ToSocketAddrs.html' title='bitflags::__core::net::ToSocketAddrs'>ToSocketAddrs</a></span></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Connects this UDP socket to a remote address, allowing the <code>send</code> and
|
||
<code>recv</code> syscalls to be used to send data and also applies filters to only
|
||
receive data from the specified address.</p>
|
||
</div><h4 id='method.send' class='method'><code>fn <a href='#method.send' class='fnname'>send</a>(&self, buf: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>&[</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u8.html'>u8</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>]</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.usize.html'>usize</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Sends data on the socket to the remote address to which it is connected.</p>
|
||
|
||
<p>The <code>connect</code> method will connect this socket to a remote address. This
|
||
method will fail if the socket is not connected.</p>
|
||
</div><h4 id='method.recv' class='method'><code>fn <a href='#method.recv' class='fnname'>recv</a>(&self, buf: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>&mut [</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u8.html'>u8</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>]</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.usize.html'>usize</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Receives data on the socket from the remote address to which it is
|
||
connected.</p>
|
||
|
||
<p>The <code>connect</code> method will connect this socket to a remote address. This
|
||
method will fail if the socket is not connected.</p>
|
||
</div><h4 id='method.set_nonblocking' class='method'><code>fn <a href='#method.set_nonblocking' class='fnname'>set_nonblocking</a>(&self, nonblocking: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.bool.html'>bool</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>()</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.9.0</span></h4>
|
||
<div class='docblock'><p>Moves this UDP socket into or out of nonblocking mode.</p>
|
||
|
||
<p>On Unix this corresponds to calling fcntl, and on Windows this
|
||
corresponds to calling ioctlsocket.</p>
|
||
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><code>impl <a class='trait' href='../../../bitflags/__core/fmt/trait.Debug.html' title='bitflags::__core::fmt::Debug'>Debug</a> for <a class='struct' href='../../../bitflags/__core/net/struct.UdpSocket.html' title='bitflags::__core::net::UdpSocket'>UdpSocket</a></code></h3><div class='impl-items'><h4 id='method.fmt' class='method'><code>fn <a href='../../../bitflags/__core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, f: &mut <a class='struct' href='../../../bitflags/__core/fmt/struct.Formatter.html' title='bitflags::__core::fmt::Formatter'>Formatter</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.tuple.html'>()</a>, <a class='struct' href='../../../bitflags/__core/fmt/struct.Error.html' title='bitflags::__core::fmt::Error'>Error</a>></code></h4>
|
||
</div><h3 class='impl'><code>impl <a class='trait' href='../../../bitflags/__core/os/ext/prelude/trait.AsRawFd.html' title='bitflags::__core::os::ext::prelude::AsRawFd'>AsRawFd</a> for <a class='struct' href='../../../bitflags/__core/net/struct.UdpSocket.html' title='bitflags::__core::net::UdpSocket'>UdpSocket</a></code></h3><div class='impl-items'><h4 id='method.as_raw_fd' class='method'><code>fn <a href='../../../bitflags/__core/os/ext/prelude/trait.AsRawFd.html#tymethod.as_raw_fd' class='fnname'>as_raw_fd</a>(&self) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.i32.html'>i32</a></code></h4>
|
||
</div><h3 class='impl'><code>impl <a class='trait' href='../../../bitflags/__core/os/ext/prelude/trait.FromRawFd.html' title='bitflags::__core::os::ext::prelude::FromRawFd'>FromRawFd</a> for <a class='struct' href='../../../bitflags/__core/net/struct.UdpSocket.html' title='bitflags::__core::net::UdpSocket'>UdpSocket</a></code><span class="since">1.1.0</span></h3><div class='impl-items'><h4 id='method.from_raw_fd' class='method'><code>unsafe fn <a href='../../../bitflags/__core/os/ext/prelude/trait.FromRawFd.html#tymethod.from_raw_fd' class='fnname'>from_raw_fd</a>(fd: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.i32.html'>i32</a>) -> <a class='struct' href='../../../bitflags/__core/net/struct.UdpSocket.html' title='bitflags::__core::net::UdpSocket'>UdpSocket</a></code></h4>
|
||
</div><h3 class='impl'><code>impl <a class='trait' href='../../../bitflags/__core/os/ext/prelude/trait.IntoRawFd.html' title='bitflags::__core::os::ext::prelude::IntoRawFd'>IntoRawFd</a> for <a class='struct' href='../../../bitflags/__core/net/struct.UdpSocket.html' title='bitflags::__core::net::UdpSocket'>UdpSocket</a></code><span class="since">1.4.0</span></h3><div class='impl-items'><h4 id='method.into_raw_fd' class='method'><code>fn <a href='../../../bitflags/__core/os/ext/prelude/trait.IntoRawFd.html#tymethod.into_raw_fd' class='fnname'>into_raw_fd</a>(self) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.i32.html'>i32</a></code></h4>
|
||
</div></section>
|
||
<section id='search' class="content hidden"></section>
|
||
|
||
<section class="footer"></section>
|
||
|
||
<aside id="help" class="hidden">
|
||
<div>
|
||
<h1 class="hidden">Help</h1>
|
||
|
||
<div class="shortcuts">
|
||
<h2>Keyboard Shortcuts</h2>
|
||
|
||
<dl>
|
||
<dt>?</dt>
|
||
<dd>Show this help dialog</dd>
|
||
<dt>S</dt>
|
||
<dd>Focus the search field</dd>
|
||
<dt>⇤</dt>
|
||
<dd>Move up in search results</dd>
|
||
<dt>⇥</dt>
|
||
<dd>Move down in search results</dd>
|
||
<dt>⏎</dt>
|
||
<dd>Go to active search result</dd>
|
||
</dl>
|
||
</div>
|
||
|
||
<div class="infos">
|
||
<h2>Search Tricks</h2>
|
||
|
||
<p>
|
||
Prefix searches with a type followed by a colon (e.g.
|
||
<code>fn:</code>) to restrict the search to a given type.
|
||
</p>
|
||
|
||
<p>
|
||
Accepted types are: <code>fn</code>, <code>mod</code>,
|
||
<code>struct</code>, <code>enum</code>,
|
||
<code>trait</code>, <code>type</code>, <code>macro</code>,
|
||
and <code>const</code>.
|
||
</p>
|
||
|
||
<p>
|
||
Search functions by type signature (e.g.
|
||
<code>vec -> usize</code> or <code>* -> vec</code>)
|
||
</p>
|
||
</div>
|
||
</div>
|
||
</aside>
|
||
|
||
|
||
|
||
<script>
|
||
window.rootPath = "../../../";
|
||
window.currentCrate = "bitflags";
|
||
window.playgroundUrl = "";
|
||
</script>
|
||
<script src="../../../jquery.js"></script>
|
||
<script src="../../../main.js"></script>
|
||
|
||
<script defer src="../../../search-index.js"></script>
|
||
</body>
|
||
</html> |