What is the preferred way to find all other clients on local network? - iphone

Writing an iPhone app in which I want to save the user the grief of typing in IP addresses by finding other clients on the local network.
Is this possible?
If so, what is the preferred way of doing this?

Yes, use Bonjour. See NSNetService.
This class is used to advertise information about the service you're running using multicast DNS. Use NSNetServiceBrowser to find published services of the type you're interested in.

The clients need some way to register with the server. Or you can use portknocking. Long time back there was a protocol from Novell SLP. There is a OpenSLP now. Found a interesting link, I hope this helps
http://www.opendoor.com/shareway/slp.html

Related

TCP based decentralised chat app in C

I need to make TCP based decentralised chat app for local network. By decentralised I mean there is no central server. Each entity on a network should have server/client architecture. When app starts it should check which user is online ( already running the app ). My question is how can i check that? Can i do it by trying to connect via connect() function from socket library? I'm new to programming, especially socket programing, so if it's a dumb question sorry in advance.
You should definitely study how other decentralized applications do this. There are lots of techniques.
Each instance of the application should, as part of its server functionality, track the addresses of other instances of the application. Each instance should, as part of its client functionality, keep track of a few instances it can connect to. Prefer instances that have been around for a long time.
The software should include a list of servers that have been running for a long time and are expected to typically be available. You may wish to include a fallback method such DNS, maintained by anyone willing to keep a list of well-known servers offering access through a well-known port. The fallback method can also be IRC or HTTP.
If you want to stay decentralized, you might want to try multicasting or broadcasting a request packet to all hosts on the network to discover other instances of your chat application.
Something similar has been implemented in Pidgin, named Bonjour. It works quite nicely and provides chatting capabilities on a local network. More specifically, it is defined as a Serverless Messaging part of XMPP.
If you are looking for code examples, have a look at one of my projects where I use multicast to discover hosts on the local network that provide a specific service: Headers and implementation.

Connecting/Tunneling through a proxy so you appear to be connecting from another country(iOS)?

I'm interested in trying to make a connection from within my app to a proxy somewhere in the UK so I can listen to radio streams there that are blocked from the UK.
What would it take technically to implement this?
Is this even possible with the API available within iOS?
Many Thanks,
-Code
I think you need to use a VPN for this kind of thing. I have (of course) never done this myself but you could use OpenVPN in theory. I don't know how useful this is and there is a writeup here to explain why I say this. You need to jailbreak your phone.

Peer-to-peer chat with the iPhone

I am aware of how many times this has been asked based on searching StackOverflow, but I am still hoping someone could tell me whether I am wrong...
I am creating a peer-to-peer chat app for the iPhone. My initial idea was to avoid using a server, so Bonjour came to mind. I was happy coding for quite a while and implemented a lot of fancy features, but two days ago I started testing with two clients from different subnets and found that the clients couldn't connect to each other! I suddenly realized that Bonjour is meant for local networks and that a DNS server is necessary for wide area service broadcasting. Do I really need a server for Internet peer-to-peer chat? Are there any other options that do not involve using a server on the iOS platform?
I am wondering how you can do a chat app without using a server. There are many cheap solutions out there, Amazon has its own service, Google does as well. You can try first without even having to pay a cent.
I found the following from apple developer guide. This should answer your question -
Does Bonjour work between multiple subnets?
Yes. The first release of DNS Service Discovery (DNS-SD) for Mac OS X concentrated on Multicast DNS (mDNS) for single-link networks because this was the environment worst served by IP software. Starting in Mac OS X 10.4, Bonjour now uses Dynamic DNS Update (RFC 2316) and unicast DNS queries to enable wide-area service discovery.
To answer the question, the only way is for you to carry a list of all possible participants, and their current IP address, and for each possible participant to report to all others each time their IP Address changes. So, if you have 100 possible participants, then you must tell 99 others when your IP Address changes, and those 99 must tell you when their IP Address changes.
Bonjour may work on a LAN, a WAN or even a WAN, but it will never work on the internet.
The role of the server is so that each end point only need to tell one end point (the server) when it changes. My advice is get a cheap internet host, with a basic PHP / MySQL capabilities, and write yourself a very simple script to post and get user identities.

Use a proxy to connect iPhone to server?

I'm researching how to code an iPhone app that needs to connect to an online service to get data. The online service only provides access to specified IP addresses or ranges, so iPhones won't be able to connect directly, and the request will have to go through a server. I looked into setting up my own forward proxy server (which the service in question are happy with, by the way), which I guess would do the job for most other platforms. Unfortunately the iPhone does not seem to allow configuring a proxy address programmatically. Is there another potential solution for accessing the content from an intermediate server, that would show the online service the IP address of the server, rather than each individual iPhone?
Many thanks
Steve
It appears that using cURL is one way to achieve this. There should be bindings available for Cocoa.
I'll let people know how it goes in the comments.
Steve

It is possible Check-in/Check-out file from WAN in Perforce

I m new to perforce, i want to know that it possible to checkin/check out file from different domain.
If you can access your perforce server then you can check in and check out files. If it's hosted on a private internal network you will need to setup SSH or some other kind of secure access to be able to talk with the server.
The short answer is yes it is possible. Perforce clients work fine from outside a LAN - low bandwidth connections are not a problem.
The long answer is that you need to have some kind of VPN/SSH access into your network so you can see the server. Talk to your IT department if you have one and they'll advise you on the specific details of your network.