Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6590341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:17:13+00:00 2026-05-25T17:17:13+00:00

I wrote a code in my application to enable Device to Device wifi Communication(transferring

  • 0

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 Witap Application which is downloaded from Developer.Apple.com.

Its working in my network fine and another networks also.

However its not working in my client site.

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 .

Is there any way to solve this problem
Is there anything other than PEER 2 PEER wifi communication which apple supports?

Prototype WIFI applications Working Concepts


There are mainly four classes in WiFi application named as AppController, Picker, BrowserViewController, TCP Server.

When application loads the AppController class will initialize NSInputStraem and NSOutPut Stream.

And also it will call “start” method from TcpServer class to set port number.

After it will call “enableBounjourWithDomain” method from TcpServer class.

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.

After the execution of this method the sender device can identify our device and able to connect.

Getting Own Device Name


Tcp serverServer delegate “DidEnabledBounjer” will work after the above code execution and it will give the current device name.

Then NSNetservice delegate “didFindService” will work (it work when each service discovered) and retrieve the discovered service name.

After getting the new service name we will check either it is same to our device name which we got from “DidEnabledBounjer” delegate.

if not ,the new service name will add into a NSMutable array named as services.

Then services array bind t o the Table view and we can see the list of discovered device names.

discovering the new devices:


No timer settings for discovering the new devices.

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).

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.

if not ,the service name will add into a NSMutable array named as services.

Then sort all the discovered ;device names according to the Device name and reload the Table View.

Working after selecting a device name from Table View


After clicking device name on the TableView it will call “didSelectRowAtIndexPath” delegate which is implemented in BrowserViewController class( it is a TableView Class delegate) .

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.

Trigger a delegate “didResolveInstance” and it will set the InPutStream and OutPutStream values.

After get ting values for InPutStream and OutPutStream it will call “OpenStream” method to open the input and output Streams.

Finally it release the NSService and Picker objects and ready to send messages with selected devices.

Working of send Button


Call “send “ function from BrowserViewController class with a string parameter .It may be user text input or generated string after speech recognition.

Convert the input string as a uint_8 data type and send it to the receiver device.

Receiver Side Working


When a data came to receiver device the “TcpServerAcceptCallBack” delegate will trigger(implemented in TcpServer Class).

It will call “DidAcceptConnectionForServer” method from BrowserViewControll calss through another TcpServer class delegate named “HandleNewConnectionFromAddress”.

Trigger the “stream handle delegate” which is in “AppController “ class and it will check is there any bites available or not.

If bytes are available convert the uint_8 type data to string and we are displaying the resultant string in receiver text box.

And also loading images and displaying it in Image View from AppBundle using the resultant string.< /p>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:17:14+00:00Added an answer on May 25, 2026 at 5:17 pm

    In the WiTap source Networking/TCPServer.m the socket’s port is set to zero (= the kernel chooses a port number, and it takes a value above 50000). You could change that 0 to e.g. 81, and the nosey security setup will no longer classify you as peer2peer. Any value between 1 and 1023 should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to write code in a Flex application that will only be
I wrote this code in C# and it works as a console application. However,
I have an application that allows users to write their own code in a
We are starting to write more and more code for an ASP.Net web application
Hi I am trying to write an application that will play morse code. I
I wrote code to set permission of the folder. Function I developed was public
I wrote some code with a lot of recursion, that takes quite a bit
I wrote this code I have these errors Cannot implicitly convert type x.Program.TreeNode' to
I wrote some code recently (ISO/ANSI C), and was surprised at the poor performance
I wrote my code using this article at msdn as a primary helper My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.