123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
- <html><head>
- <title>3PCAP man page</title>
- <meta name="generator" content="roffit">
- <STYLE type="text/css">
- pre {
- overflow: auto;
- margin: 0;
- }
- P.level0, pre.level0 {
- padding-left: 2em;
- }
- P.level1, pre.level1 {
- padding-left: 4em;
- }
- P.level2, pre.level2 {
- padding-left: 6em;
- }
- span.emphasis {
- font-style: italic;
- }
- span.bold {
- font-weight: bold;
- }
- span.manpage {
- font-weight: bold;
- }
- h2.nroffsh {
- background-color: #e0e0e0;
- }
- span.nroffip {
- font-weight: bold;
- font-size: 120%;
- font-family: monospace;
- }
- p.roffit {
- text-align: center;
- font-size: 80%;
- }
- </STYLE>
- </head><body>
- <p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2>
- <p class="level0">pcap_setnonblock, pcap_getnonblock - set or get the state of non-blocking mode on a capture device <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2>
- <p class="level0"><pre class="level0">
- #include <pcap/pcap.h>
- <pre class="level0">
- char errbuf[PCAP_ERRBUF_SIZE];
- int pcap_setnonblock(pcap_t *p, int nonblock, char *errbuf);
- int pcap_getnonblock(pcap_t *p, char *errbuf);
- </pre>
- <p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2>
- <p class="level0"><span Class="bold">pcap_setnonblock</span>() puts a capture handle into ``non-blocking'' mode, or takes it out of ``non-blocking'' mode, depending on whether the <span Class="emphasis">nonblock</span> argument is non-zero or zero. It has no effect on ``savefiles''. If there is an error, <span Class="bold">PCAP_ERROR</span> is returned and <span Class="emphasis">errbuf</span> is filled in with an appropriate error message; otherwise, <span Class="bold">0</span> is returned.
- <p class="level0">In ``non-blocking'' mode, an attempt to read from the capture descriptor with <span Class="bold">pcap_dispatch</span>(3PCAP) and <a Class="bold" href="./pcap_next_ex.html">pcap_next_ex</a>(3PCAP) will, if no packets are currently available to be read, return <span Class="bold">0</span> immediately rather than blocking waiting for packets to arrive.
- <p class="level0"><a Class="bold" href="./pcap_loop.html">pcap_loop</a>(3PCAP) will loop forever, consuming CPU time when no packets are currently available; <span Class="bold">pacp_dispatch</span>() should be used instead. <span Class="bold">pcap_next</span>(3PCAP) will return <span Class="bold">NULL</span> if there are no packets currently available to read; this is indistinguishable from an error, so <span Class="bold">pcap_next_ex</span>() should be used instead.
- <p class="level0">When first activated with <a Class="bold" href="./pcap_activate.html">pcap_activate</a>(3PCAP) or opened with <a Class="bold" href="./pcap_open_live.html">pcap_open_live</a>(3PCAP)<span Class="bold">,</span> a capture handle is not in ``non-blocking mode''; a call to <span Class="bold">pcap_setnonblock</span>() is required in order to put it into ``non-blocking'' mode. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2>
- <p class="level0"><span Class="bold">pcap_getnonblock</span>() returns the current ``non-blocking'' state of the capture descriptor; it always returns <span Class="bold">0</span> on ``savefiles''. If called on a capture handle that has been created but not activated, <span Class="bold">PCAP_ERROR_NOT_ACTIVATED</span> is returned. If there is another error, <span Class="bold">PCAP_ERROR</span> is returned and <span Class="emphasis">errbuf</span> is filled in with an appropriate error message.
- <p class="level0"><span Class="emphasis">errbuf</span> is assumed to be able to hold at least <span Class="bold">PCAP_ERRBUF_SIZE</span> chars. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2>
- <p class="level0"><a Class="bold" href="./pcap.html">pcap</a>(3PCAP), <a Class="bold" href="./pcap_next_ex.html">pcap_next_ex</a>(3PCAP), <a Class="bold" href="./pcap_geterr.html">pcap_geterr</a>(3PCAP) <p class="roffit">
- This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>.
- </body></html>
|