Host library for controlling a WiConnect enabled Wi-Fi module.

Dependents:   wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more

Committer:
dan_ackme
Date:
Tue Aug 26 16:38:19 2014 -0700
Revision:
21:17bb3eddcbae
Child:
26:8067e3d463d3
Add TCP server API

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dan_ackme 21:17bb3eddcbae 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
dan_ackme 21:17bb3eddcbae 2 <html xmlns="http://www.w3.org/1999/xhtml">
dan_ackme 21:17bb3eddcbae 3 <head>
dan_ackme 21:17bb3eddcbae 4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
dan_ackme 21:17bb3eddcbae 5 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
dan_ackme 21:17bb3eddcbae 6 <title>ACKme WiConnect Host Library</title>
dan_ackme 21:17bb3eddcbae 7 <link rel="icon" href="favicon.ico" type="image/x-icon">
dan_ackme 21:17bb3eddcbae 8 <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
dan_ackme 21:17bb3eddcbae 9 <link href="tabs.css" rel="stylesheet" type="text/css"/>
dan_ackme 21:17bb3eddcbae 10 <script type="text/javascript" src="jquery.js"></script>
dan_ackme 21:17bb3eddcbae 11 <script type="text/javascript" src="dynsections.js"></script>
dan_ackme 21:17bb3eddcbae 12 <link href="navtree.css" rel="stylesheet" type="text/css"/>
dan_ackme 21:17bb3eddcbae 13 <script type="text/javascript" src="resize.js"></script>
dan_ackme 21:17bb3eddcbae 14 <script type="text/javascript" src="navtree.js"></script>
dan_ackme 21:17bb3eddcbae 15 <script type="text/javascript">
dan_ackme 21:17bb3eddcbae 16 $(document).ready(initResizable);
dan_ackme 21:17bb3eddcbae 17 $(window).load(resizeHeight);
dan_ackme 21:17bb3eddcbae 18 </script>
dan_ackme 21:17bb3eddcbae 19 <link href="search/search.css" rel="stylesheet" type="text/css"/>
dan_ackme 21:17bb3eddcbae 20 <script type="text/javascript" src="search/search.js"></script>
dan_ackme 21:17bb3eddcbae 21 <script type="text/javascript">
dan_ackme 21:17bb3eddcbae 22 $(document).ready(function() { searchBox.OnSelectItem(0); });
dan_ackme 21:17bb3eddcbae 23 </script>
dan_ackme 21:17bb3eddcbae 24 <link href="doxygen.css" rel="stylesheet" type="text/css" />
dan_ackme 21:17bb3eddcbae 25 </head>
dan_ackme 21:17bb3eddcbae 26 <body>
dan_ackme 21:17bb3eddcbae 27 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
dan_ackme 21:17bb3eddcbae 28 <div id="titlearea" style="font-family:verdana;">
dan_ackme 21:17bb3eddcbae 29 <table border='0' cellpadding='0' cellspacing='0' width="98%">
dan_ackme 21:17bb3eddcbae 30 <tr style="height:20px"><td>&nbsp;</td></tr>
dan_ackme 21:17bb3eddcbae 31 <tr style="border-collapse: collapse; padding: 0;">
dan_ackme 21:17bb3eddcbae 32 <td style="width:20px"></td>
dan_ackme 21:17bb3eddcbae 33 <td style="padding-right:40px"><img src="ackmelogo.png" alt="ACKme Logo" /></td>
dan_ackme 21:17bb3eddcbae 34 <td style="vertical-align:middle; text-align:left; font: bold 25px/100% Verdana, Arial, Helvetica, sans-serif;">
dan_ackme 21:17bb3eddcbae 35 WiConnect Host Library- API Reference Guide</td>
dan_ackme 21:17bb3eddcbae 36 <td style="width:20px"></td>
dan_ackme 21:17bb3eddcbae 37 </tr>
dan_ackme 21:17bb3eddcbae 38 <tr><td>&nbsp;</td></tr>
dan_ackme 21:17bb3eddcbae 39 </table>
dan_ackme 21:17bb3eddcbae 40 </div><!-- Generated by Doxygen 1.8.7 -->
dan_ackme 21:17bb3eddcbae 41 <script type="text/javascript">
dan_ackme 21:17bb3eddcbae 42 var searchBox = new SearchBox("searchBox", "search",false,'Search');
dan_ackme 21:17bb3eddcbae 43 </script>
dan_ackme 21:17bb3eddcbae 44 <div id="navrow1" class="tabs">
dan_ackme 21:17bb3eddcbae 45 <ul class="tablist">
dan_ackme 21:17bb3eddcbae 46 <li><a href="index.html"><span>Library&#160;Overview</span></a></li>
dan_ackme 21:17bb3eddcbae 47 <li><a href="modules.html"><span>Library&#160;API</span></a></li>
dan_ackme 21:17bb3eddcbae 48 <li><a href="examples.html"><span>API&#160;Examples</span></a></li>
dan_ackme 21:17bb3eddcbae 49 <li><a href="annotated.html"><span>Classes</span></a></li>
dan_ackme 21:17bb3eddcbae 50 <li><a href="http://wiconnect.ack.me/1.2/general_overview"><span>WiConnect&#160;Reference&#160;Manual</span></a></li>
dan_ackme 21:17bb3eddcbae 51 <li><a href="http://www.ack.me/WiConnect"><span>ACKme&#160;Website</span></a></li>
dan_ackme 21:17bb3eddcbae 52 <li>
dan_ackme 21:17bb3eddcbae 53 <div id="MSearchBox" class="MSearchBoxInactive">
dan_ackme 21:17bb3eddcbae 54 <span class="left">
dan_ackme 21:17bb3eddcbae 55 <img id="MSearchSelect" src="search/mag_sel.png"
dan_ackme 21:17bb3eddcbae 56 onmouseover="return searchBox.OnSearchSelectShow()"
dan_ackme 21:17bb3eddcbae 57 onmouseout="return searchBox.OnSearchSelectHide()"
dan_ackme 21:17bb3eddcbae 58 alt=""/>
dan_ackme 21:17bb3eddcbae 59 <input type="text" id="MSearchField" value="Search" accesskey="S"
dan_ackme 21:17bb3eddcbae 60 onfocus="searchBox.OnSearchFieldFocus(true)"
dan_ackme 21:17bb3eddcbae 61 onblur="searchBox.OnSearchFieldFocus(false)"
dan_ackme 21:17bb3eddcbae 62 onkeyup="searchBox.OnSearchFieldChange(event)"/>
dan_ackme 21:17bb3eddcbae 63 </span><span class="right">
dan_ackme 21:17bb3eddcbae 64 <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
dan_ackme 21:17bb3eddcbae 65 </span>
dan_ackme 21:17bb3eddcbae 66 </div>
dan_ackme 21:17bb3eddcbae 67 </li>
dan_ackme 21:17bb3eddcbae 68 </ul>
dan_ackme 21:17bb3eddcbae 69 </div>
dan_ackme 21:17bb3eddcbae 70 </div><!-- top -->
dan_ackme 21:17bb3eddcbae 71 <div id="side-nav" class="ui-resizable side-nav-resizable">
dan_ackme 21:17bb3eddcbae 72 <div id="nav-tree">
dan_ackme 21:17bb3eddcbae 73 <div id="nav-tree-contents">
dan_ackme 21:17bb3eddcbae 74 <div id="nav-sync" class="sync"></div>
dan_ackme 21:17bb3eddcbae 75 </div>
dan_ackme 21:17bb3eddcbae 76 </div>
dan_ackme 21:17bb3eddcbae 77 <div id="splitbar" style="-moz-user-select:none;"
dan_ackme 21:17bb3eddcbae 78 class="ui-resizable-handle">
dan_ackme 21:17bb3eddcbae 79 </div>
dan_ackme 21:17bb3eddcbae 80 </div>
dan_ackme 21:17bb3eddcbae 81 <script type="text/javascript">
dan_ackme 21:17bb3eddcbae 82 $(document).ready(function(){initNavTree('tcp__client_8py_source.html','');});
dan_ackme 21:17bb3eddcbae 83 </script>
dan_ackme 21:17bb3eddcbae 84 <div id="doc-content">
dan_ackme 21:17bb3eddcbae 85 <!-- window showing the filter options -->
dan_ackme 21:17bb3eddcbae 86 <div id="MSearchSelectWindow"
dan_ackme 21:17bb3eddcbae 87 onmouseover="return searchBox.OnSearchSelectShow()"
dan_ackme 21:17bb3eddcbae 88 onmouseout="return searchBox.OnSearchSelectHide()"
dan_ackme 21:17bb3eddcbae 89 onkeydown="return searchBox.OnSearchSelectKey(event)">
dan_ackme 21:17bb3eddcbae 90 <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>
dan_ackme 21:17bb3eddcbae 91
dan_ackme 21:17bb3eddcbae 92 <!-- iframe showing the search results (closed by default) -->
dan_ackme 21:17bb3eddcbae 93 <div id="MSearchResultsWindow">
dan_ackme 21:17bb3eddcbae 94 <iframe src="javascript:void(0)" frameborder="0"
dan_ackme 21:17bb3eddcbae 95 name="MSearchResults" id="MSearchResults">
dan_ackme 21:17bb3eddcbae 96 </iframe>
dan_ackme 21:17bb3eddcbae 97 </div>
dan_ackme 21:17bb3eddcbae 98
dan_ackme 21:17bb3eddcbae 99 <div class="header">
dan_ackme 21:17bb3eddcbae 100 <div class="headertitle">
dan_ackme 21:17bb3eddcbae 101 <div class="title">tcp_client.py</div> </div>
dan_ackme 21:17bb3eddcbae 102 </div><!--header-->
dan_ackme 21:17bb3eddcbae 103 <div class="contents">
dan_ackme 21:17bb3eddcbae 104 <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="keyword">import</span> socket</div>
dan_ackme 21:17bb3eddcbae 105 <div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160; </div>
dan_ackme 21:17bb3eddcbae 106 <div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;ECHO_SERVER_ADDRESS = <span class="stringliteral">&quot;192.168.1.52&quot;</span></div>
dan_ackme 21:17bb3eddcbae 107 <div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;ECHO_PORT = 7</div>
dan_ackme 21:17bb3eddcbae 108 <div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160; </div>
dan_ackme 21:17bb3eddcbae 109 <div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) </div>
dan_ackme 21:17bb3eddcbae 110 <div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;s.connect((ECHO_SERVER_ADDRESS, ECHO_PORT))</div>
dan_ackme 21:17bb3eddcbae 111 <div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160; </div>
dan_ackme 21:17bb3eddcbae 112 <div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;s.sendall(<span class="stringliteral">&#39;Hello, world&#39;</span>)</div>
dan_ackme 21:17bb3eddcbae 113 <div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;data = s.recv(1024)</div>
dan_ackme 21:17bb3eddcbae 114 <div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="keywordflow">print</span> <span class="stringliteral">&#39;Received&#39;</span>, repr(data)</div>
dan_ackme 21:17bb3eddcbae 115 <div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;s.close()</div>
dan_ackme 21:17bb3eddcbae 116 </div><!-- fragment --></div><!-- contents -->
dan_ackme 21:17bb3eddcbae 117 </div><!-- doc-content -->
dan_ackme 21:17bb3eddcbae 118 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
dan_ackme 21:17bb3eddcbae 119 <ul>
dan_ackme 21:17bb3eddcbae 120 <li class="footer">&copy; ACKme Networks 2014</li>
dan_ackme 21:17bb3eddcbae 121 </ul>
dan_ackme 21:17bb3eddcbae 122 </div>
dan_ackme 21:17bb3eddcbae 123 </body>
dan_ackme 21:17bb3eddcbae 124 </html>