Wifi Device to Device Communication problem <p>I wrote a code in my application to enable Device to Device wifi Communication(transferring only a text/string).The code is same as the Apple's sample <strong>Witap</strong> Application which is downloaded from Developer.Apple.com.</p> <p>Its working in my network fine and another networks also.</p> <p>However its not working in my client site.</p> <p>I spent time at the Client site to sort out the issue with the Devices not communicating to each other and this is what I found. They in their security setup block peer to peer communication…" and my device communication is identified as peer to peer .</p> <p><strong>Is there any way to solve this problem Is there anything other than PEER 2 PEER wifi communication which apple supports?</strong></p> <p>Prototype WIFI applications Working Concepts</p> <hr> <p>There are mainly four classes in WiFi application named as AppController, Picker, BrowserViewController, TCP Server.</p> <p>When application loads the AppController class will initialize NSInputStraem and NSOutPut Stream.</p> <p>And also it will call “start” method from TcpServer class to set port number.</p> <p>After it will call “enableBounjourWithDomain” method from TcpServer class.</p> <p>The above method call with a parameter called as identifier (it is a common name eg:WiTap) and the sender part is searching devices with this common identifier.</p> <p>After the execution of this method the sender device can identify our device and able to connect.</p> <p>Getting Own Device Name</p> <hr> <p>Tcp serverServer delegate “DidEnabledBounjer” will work after the above code execution and it will give the current device name.</p> <p>Then NSNetservice delegate “didFindService” will work (it work when each service discovered) and retrieve the discovered service name.</p> <p>After getting the new service name we will check either it is same to our device name which we got from “DidEnabledBounjer” delegate.</p> <p>if not ,the new service name will add into a NSMutable array named as services.</p> <p>Then services array bind t o the Table view and we can see the list of discovered device names.</p> <p>discovering the new devices:</p> <hr> <p>No timer settings for discovering the new devices.</p> <p>When a new device is connected in the same WiFi net work the “DidFindservice” delegate will trigger(it is a NSNetservice delegate implemented in BrowserViewController class).</p> <p>DidFindservice will give the new device name .After getting it we will check either it is same to our device name witch we got from “DidEnabledBounjer” delegate.</p> <p>if not ,the service name will add into a NSMutable array named as services.</p> <p>Then sort all the discovered ;device names according to the Device name and reload the Table View.</p> <p>Working after selecting a device name from Table View</p> <hr> <p>After clicking device name on the TableView it will call “didSelectRowAtIndexPath” delegate which is implemented in BrowserViewController class( it is a TableView Class delegate) .</p> <p>It will select a NetService name from our services array(holds all the discovered services) according to the TableView index and set resultant NSService as Current Service.</p> <p>Trigger a delegate “didResolveInstance” and it will set the InPutStream and OutPutStream values.</p> <p>After get ting values for InPutStream and OutPutStream it will call “OpenStream” method to open the input and output Streams.</p> <p>Finally it release the NSService and Picker objects and ready to send messages with selected devices.</p> <p>Working of send Button</p> <hr> <p>Call “send “ function from BrowserViewController class with a string parameter .It may be user text input or generated string after speech recognition.</p> <p>Convert the input string as a uint_8 data type and send it to the receiver device.</p> <p>Receiver Side Working</p> <hr> <p>When a data came to receiver device the “TcpServerAcceptCallBack” delegate will trigger(implemented in TcpServer Class).</p> <p>It will call “DidAcceptConnectionForServer” method from BrowserViewControll calss through another TcpServer class delegate named “HandleNewConnectionFromAddress”.</p> <p>Trigger the “stream handle delegate” which is in “AppController “ class and it will check is there any bites available or not.</p> <p>If bytes are available convert the uint_8 type data to string and we are displaying the resultant string in receiver text box.</p> <p>And also loading images and displaying it in Image View from AppBundle using the resultant string.&lt; /p></p>