www.pudn.com > Proximity-sample.zip > description.html, change:2012-06-01,size:10893b

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
        <title>Proximity sample</title> 
        <link href="description/Galleries.css" type="text/css" rel="Stylesheet" /><link href="description/Layout.css" type="text/css" rel="Stylesheet" /><link href="description/Brand.css" type="text/css" rel="Stylesheet" /><link href="description/eea14019-75b7-4d19-bba5-b03c413df023Brand.css" type="text/css" rel="Stylesheet" /> 
        <link href="description/iframedescription.css" rel="Stylesheet" type="text/css" /> 
        <script src="description/offline.js" type="text/javascript"></script> 
        <style type="text/css"> 
            #projectInfo { 
                overflow: auto; 
            #longDesc { 
                margin: 25px 0 10px 0; 
                margin-left: 15px; 
    <div id="offlineDescription"> 
        <div id="projectInfo"> 
            <div class="section"> 
                    <div class="itemBarLong tagsContainer"> 
                        <label for="Technologies">Technologies</label> 
                        <div id="Technologies"> 
                            Windows Runtime 
                    <div class="itemBarLong tagsContainer"> 
                        <label for="Topics">Topics</label> 
                        <div id="Topics"> 
                            Devices and sensors 
                <div class="itemBar"> 
                    <label for="LastUpdated">Last Updated</label> 
                    <div id="LastUpdated">5/31/2012</div> 
                <div class="itemBarLong"> 
                    <label for="License">License</label> 
                    <div id="License"> 
                        <a href="license.rtf">MS-LPL</a></div> 
                <div class="itemBar"> 
                    <div class="viewonlinecont"> 
                        <a data-link="online" href="http://code.msdn.microsoft.com/windowsapps/Proximity-Sample-88129731">View this sample online</a> 
<script type="text/javascript"> 
    function initializePage() { 
        var otherTabClass = 'otherTab'; 
        var hiddenPreClass = 'hidden'; 
        var htmlDecode = function(encodedData) { 
            var decodedData = ""; 
            if (encodedData) { 
                var div = document.createElement('div'); 
                div.innerHTML = encodedData; 
                decodedData = div.firstChild.nodeValue.replace( /\\r\\n/ig , '\r\n'); 
            return decodedData; 
        Galleries.iterateElem(Galleries.findElem(null, 'div', 'scriptcode'), function (index, scriptBlock) { 
            var titleElem = Galleries.findElem(scriptBlock, 'div', 'title')[0]; 
            var labelElems = Galleries.findElem(titleElem, 'span'); 
            if (labelElems.length == 0) { 
                labelElems = titleElem; 
            var languageSpans = Galleries.findElem(scriptBlock, 'span', 'hidden'); 
            var pres = Galleries.findElem(scriptBlock, 'pre'); 
            if (languageSpans.length > 0 && pres.length > 1) { 
                Galleries.iterateElem(labelElems, function(index, elem) { 
                    var codePre = pres[index]; 
                    var labelSpan = elem; 
                    var languageSpan = languageSpans[index]; 
                    elem.code = codePre.innerHTML.replace( /(\r(\n)?)|((\r)?\n)/ig , '\\r\\n'); 
                    codePre.className = codePre.className.replace(hiddenPreClass, ''); 
                pres = Galleries.findElem(scriptBlock, 'pre'); 
                Galleries.iterateElem(labelElems, function(index, elem) { 
                    var codePre = pres[index]; 
                    var labelSpan = elem; 
                    if (index == 0) { 
                        scriptBlock.activeTab = 0; 
                    else { 
                        labelSpan.className += otherTabClass; 
                        codePre.className += hiddenPreClass; 
                    Galleries.attachEventHandler(labelSpan, 'click', function(e) { 
                        var activeTab = scriptBlock.activeTab; 
                        labelElems[activeTab].className += otherTabClass; 
                        pres[activeTab].className += hiddenPreClass; 
                        codePre.className = codePre.className.replace(hiddenPreClass, ''); 
                        labelSpan.className = labelSpan.className.replace(otherTabClass, ''); 
                        scriptBlock.activeTab = index; 
                var preview = Galleries.findElem(scriptBlock, 'div', 'preview'); 
                if (preview.length == 0) { 
                    preview.push(pres[pres.length - 1]); 
                Galleries.iterateElem(preview, function(index, elem) { 
                if (window.clipboardData && clipboardData.setData) { 
                    var copyLink = document.createElement('a'); 
                    copyLink.href = 'javascript:void(0);'; 
                    copyLink.className = 'copyCode'; 
                    copyLink.innerHTML = 'Copy Code'; 
                    Galleries.attachEventHandler(copyLink, 'click', function (e) { 
                        clipboardData.setData("Text", htmlDecode(labelElems[scriptBlock.activeTab].code)); 
                        return false; 
                    scriptBlock.insertBefore(copyLink, scriptBlock.childNodes[0]); 
<div id="longDesc"> 
<div id="mainSection"> 
<div class="clsServerSDKContent"> 
<h1><a id="gallery_sample.proximity"></a>Proximity sample</h1> 
<p>This sample demonstrates how to use the <a href="http://msdn.microsoft.com/library/windows/apps/BR241203"> 
<b>PeerFinder</b> </a>and <a href="http://msdn.microsoft.com/library/windows/apps/BR241212"> 
<b>ProximityDevice</b> </a>classes to communicate with nearby computers </p> 
<p>You can use the Proximity API to exchange small messages during a tap gesture or set up a socket connection between peer apps. The 
<a href="http://msdn.microsoft.com/library/windows/apps/BR241203"><b>PeerFinder</b> 
</a>sample (scenario 1) demonstrates how to use the Proximity API to create a socket connection between peer apps on two computers using a tap gesture or by browsing using a wireless radio. The 
<a href="http://msdn.microsoft.com/library/windows/apps/BR241212"><b>ProximityDevice</b> 
</a>samples (scenario 2 and 3) demonstrate how to send small message payloads between two computers during a tap gesture.</p> 
<p>This sample must be run on two computers. For scenarios that use a tap gesture, each computer must have a proximity device installed. For scenarios that use wireless browsing, each computer must have a wireless device that supports Wi-Fi Direct installed. 
 If you don't have hardware that supports proximity tapping such as Near-Field Communication (NFC) radio, you can use the proximity driver sample that is part of the Windows Driver Kit (WDK) samples. You can use the sample driver to simulate a tap gesture over 
 a network connection between two computers. For information on how to download the WDK, see 
<a href="http://msdn.microsoft.com/en-us/windows/hardware/gg487463">How to get the WDK</a>. After you have installed the WDK and samples, you can find the proximity driver sample in the src\nfp directory in the location where you installed the WDK samples. 
 See the NetNfpProvider.html file in the src\nfp\net directory for instructions on building and running the simulator. After you start the simulator, it runs in the background while your proximity app is running in the foreground. Your app must be in the foreground 
 for the tap simulation to work.</p> 
<p>To obtain an evaluation copy of Windows 8 Release Preview, go to <a href="http://go.microsoft.com/fwlink/?LinkId=241655"> 
Windows 8</a>.</p> 
<p>To obtain an evaluation copy of Microsoft Visual Studio 2012 RC, go to <a href="http://go.microsoft.com/fwlink/?LinkId=241656"> 
Visual Studio 2012 RC</a>.</p> 
<h3><a id="related_topics"></a>Related topics</h3> 
<dl><dt><a href="http://msdn.microsoft.com/library/windows/apps/Hh465207">Quickstart: Connecting applications using tapping or browsing (JavaScript)</a> 
</dt><dt><a href="http://msdn.microsoft.com/library/windows/apps/Hh465205">Quickstart: Connecting applications using tapping or browsing (C#)</a> 
</dt><dt><a href="http://msdn.microsoft.com/library/windows/apps/Hh465223">Quickstart: Publishing and subscribing to messages using tapping (JavaScript)</a> 
</dt><dt><a href="http://msdn.microsoft.com/library/windows/apps/Hh465213">Quickstart: Publishing and subscribing to messages using tapping (C#)</a> 
</dt><dt><a href="http://msdn.microsoft.com/library/windows/apps/Hh465215">Guidelines and checklist for proximity</a> 
</dt><dt><a href="http://msdn.microsoft.com/library/windows/apps/BR241250">Windows.Networking.Proximity</a> 
<h3>Operating system requirements</h3> 
<td><dt>Windows 8 Release Preview </dt></td> 
<td><dt>Windows Server 2012 </dt></td> 
<h3>Build the sample</h3> 
<li>Start Visual Studio 2012 RC and select <b>File > Open > Project/Solution</b>. 
</li><li>Go to the directory in which you unzipped the sample. Go to the directory named for the sample, and double-click the Microsoft Visual Studio Solution (.sln) file. 
</li><li>Press F6 or use <b>Build > Build Solution</b> to build the sample. </li></ol> 
<h3>Run the sample</h3> 
<p>To debug the app and then run it, press F5 or use <b>Debug</b> > <b>Start Debugging</b>. To run the app without debugging, press Ctrl+F5 or use 
<b>Debug</b> > <b>Start Without Debugging</b>.</p>