jbus/Socket_8hpp_source.html

146 lines
65 KiB
HTML
Raw Normal View History

2017-01-07 23:46:40 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>JBus: include/jbus/Socket.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">JBus
</div>
<div id="projectbrief">JoyBus communication server</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('Socket_8hpp_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Socket.hpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="Socket_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="preprocessor">#ifndef JBUS_SOCKET_HPP</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="preprocessor">#define JBUS_SOCKET_HPP</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;</div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="preprocessor">#ifndef _WIN32</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="preprocessor">#include &lt;sys/socket.h&gt;</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="preprocessor">#include &lt;netinet/in.h&gt;</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="preprocessor">#include &lt;netinet/tcp.h&gt;</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="preprocessor">#include &lt;arpa/inet.h&gt;</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="preprocessor">#include &lt;netdb.h&gt;</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="preprocessor">#include &lt;unistd.h&gt;</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="preprocessor">#include &lt;errno.h&gt;</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="preprocessor">#else</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="preprocessor">#include &lt;winsock2.h&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="preprocessor">#include &lt;Ws2tcpip.h&gt;</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="preprocessor">#include &lt;sys/types.h&gt;</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="preprocessor">#include &lt;fcntl.h&gt;</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="Common_8hpp.html">Common.hpp</a>&quot;</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacejbus.html">jbus</a></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;{</div><div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="namespacejbus_1_1net.html"> 25</a></span>&#160;<span class="keyword">namespace </span>net</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;{</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;<span class="comment">/* Define the low-level send/receive flags, which depend on the OS */</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="preprocessor">#ifdef __linux__</span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> <span clas
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_ae3e4995fb077912fa51764053e931bae"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#ae3e4995fb077912fa51764053e931bae">jbus::net::Socket::send</a></div><div class="ttdeci">EResult send(const void *buf, size_t len, size_t &amp;transferred)</div><div class="ttdef"><b>Definition:</b> Socket.hpp:299</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_aa6baaf24a436a72735d0561f907864eb"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#aa6baaf24a436a72735d0561f907864eb">jbus::net::Socket::openAndListen</a></div><div class="ttdeci">bool openAndListen(const IPAddress &amp;address, uint32_t port)</div><div class="ttdef"><b>Definition:</b> Socket.hpp:216</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_a5563c140f709a91585cafbb27151720a"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#a5563c140f709a91585cafbb27151720a">jbus::net::Socket::recv</a></div><div class="ttdeci">EResult recv(void *buf, size_t len)</div><div class="ttdef"><b>Definition:</b> Socket.hpp:362</div></div>
<div class="ttc" id="namespacejbus_html"><div class="ttname"><a href="namespacejbus.html">jbus</a></div><div class="ttdef"><b>Definition:</b> Common.hpp:8</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html">jbus::net::Socket</a></div><div class="ttdef"><b>Definition:</b> Socket.hpp:103</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_a31a6b806331c0856658e08fe9a77b32d"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#a31a6b806331c0856658e08fe9a77b32d">jbus::net::Socket::isOpen</a></div><div class="ttdeci">bool isOpen() const </div><div class="ttdef"><b>Definition:</b> Socket.hpp:215</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_a145c616a39461c9ab57e021a51f746e4"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#a145c616a39461c9ab57e021a51f746e4">jbus::net::Socket::recv</a></div><div class="ttdeci">EResult recv(void *buf, size_t len, size_t &amp;transferred)</div><div class="ttdef"><b>Definition:</b> Socket.hpp:334</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_ad981ced8a7a6f1bf5a3e6067df1ada9d"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#ad981ced8a7a6f1bf5a3e6067df1ada9d">jbus::net::Socket::close</a></div><div class="ttdeci">void close()</div><div class="ttdef"><b>Definition:</b> Socket.hpp:287</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_a3d2700e84af823fb63c8119f033a799d"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#a3d2700e84af823fb63c8119f033a799d">jbus::net::Socket::~Socket</a></div><div class="ttdeci">~Socket()</div><div class="ttdef"><b>Definition:</b> Socket.hpp:182</div></div>
<div class="ttc" id="classjbus_1_1net_1_1IPAddress_html"><div class="ttname"><a href="classjbus_1_1net_1_1IPAddress.html">jbus::net::IPAddress</a></div><div class="ttdef"><b>Definition:</b> Socket.hpp:36</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_af761a3e1046b017ee919595af021bede"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#af761a3e1046b017ee919595af021bede">jbus::net::Socket::operator=</a></div><div class="ttdeci">Socket &amp; operator=(Socket &amp;&amp;other)</div><div class="ttdef"><b>Definition:</b> Socket.hpp:191</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_a4eac487033d8a6b855f5023955c6d1fc"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#a4eac487033d8a6b855f5023955c6d1fc">jbus::net::Socket::accept</a></div><div class="ttdeci">EResult accept(Socket &amp;remoteSocketOut)</div><div class="ttdef"><b>Definition:</b> Socket.hpp:269</div></div>
<div class="ttc" id="classjbus_1_1net_1_1IPAddress_html_a36ccdd7a0630a183c16943a21b3c908c"><div class="ttname"><a href="classjbus_1_1net_1_1IPAddress.html#a36ccdd7a0630a183c16943a21b3c908c">jbus::net::IPAddress::toInteger</a></div><div class="ttdeci">uint32_t toInteger() const </div><div class="ttdef"><b>Definition:</b> Socket.hpp:94</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_ae55b301ad32ba4a0fe54e7282c2e3e50"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#ae55b301ad32ba4a0fe54e7282c2e3e50">jbus::net::Socket::Socket</a></div><div class="ttdeci">Socket(Socket &amp;&amp;other)</div><div class="ttdef"><b>Definition:</b> Socket.hpp:186</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_aeff335671da65f7397f86af7b712384f"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#aeff335671da65f7397f86af7b712384f">jbus::net::Socket::send</a></div><div class="ttdeci">EResult send(const void *buf, size_t len)</div><div class="ttdef"><b>Definition:</b> Socket.hpp:328</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_afb79caaa1f0d96afb0088f9910c9c633"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#afb79caaa1f0d96afb0088f9910c9c633">jbus::net::Socket::accept</a></div><div class="ttdeci">EResult accept(Socket &amp;remoteSocketOut, sockaddr_in &amp;fromAddress)</div><div class="ttdef"><b>Definition:</b> Socket.hpp:239</div></div>
<div class="ttc" id="Common_8hpp_html"><div class="ttname"><a href="Common_8hpp.html">Common.hpp</a></div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_a3bfd450bea54d958e35330aa7faa113f"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#a3bfd450bea54d958e35330aa7faa113f">jbus::net::Socket::EResult</a></div><div class="ttdeci">EResult</div><div class="ttdef"><b>Definition:</b> Socket.hpp:159</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_a87bf8bdb4a07533dc7eccfd5bb84857d"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#a87bf8bdb4a07533dc7eccfd5bb84857d">jbus::net::Socket::Socket</a></div><div class="ttdeci">Socket(bool blocking)</div><div class="ttdef"><b>Definition:</b> Socket.hpp:180</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_a9ee7eee273fdb17fed00972dff0136ee"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#a9ee7eee273fdb17fed00972dff0136ee">jbus::net::Socket::setBlocking</a></div><div class="ttdeci">void setBlocking(bool blocking)</div><div class="ttdef"><b>Definition:</b> Socket.hpp:200</div></div>
<div class="ttc" id="classjbus_1_1net_1_1Socket_html_a7775d73e68c92ca6685cc2c9bbad4f99"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html#a7775d73e68c92ca6685cc2c9bbad4f99">jbus::net::Socket::accept</a></div><div class="ttdeci">EResult accept(Socket &amp;remoteSocketOut, std::string &amp;fromHostname)</div><div class="ttdef"><b>Definition:</b> Socket.hpp:275</div></div>
<div class="ttc" id="classjbus_1_1net_1_1IPAddress_html_a7a9262cd458bcf8e63d5b9204edfdde9"><div class="ttname"><a href="classjbus_1_1net_1_1IPAddress.html#a7a9262cd458bcf8e63d5b9204edfdde9">jbus::net::IPAddress::IPAddress</a></div><div class="ttdeci">IPAddress(const std::string &amp;address)</div><div class="ttdef"><b>Definition:</b> Socket.hpp:89</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_4525d057f72f34aebe3436e89afccf45.html">jbus</a></li><li class="navelem"><a class="el" href="Socket_8hpp.html">Socket.hpp</a></li>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>