How can i find all network devices without Bonjour? - objective-c

I writing a mac application and i need to discover other Macs/PCs/iPhones/iPads connected to the same WIFI network.
Bonjour seems to be the most reasonable choice, but it turned out that it has problems on many types of routers (on mine for example, is not working as it blocks Bonjour services).
I just need to find iPs of devices, then i will try to connect to an application-specific port to determine if my process is running there.
What is the best approach to accomplish this task, without violating the App store Sandboxing?

ARP was the first answer which came to my mind. Does your network-setup allows this?

Related

What is the difference between Weave and Openthread?

I would like to work on Weave but I noticed that Nest has open sourced Openthread instead. I would like to get my hands dirty with Openthread but if someone can answer these questions for me I would really appreciate that.
Is one preferred over the other for certain applications. If so, what are they?
Will devices running Openthread be directly compatible with ones running Weave?
Will these devices be able to communicate with Android devices as is or is future support in Android being planned?
What soc's or emulators can I test Openthread on?
Thanks in advance!
First Question
Succinctly, in terms of the OSI model:
Thread is a network technology that defines layer 2 (link-layer) and layer 3 (network-layer). Thread gives your embedded device IPv6 interface with some nifty capabilities, such as fault-tolerance, mesh networking, and low power consumption.
Weave is (for the most part) a layer 6 protocol, like CoAP or HTTP. It is a protocol that applications running on embedded devices can use to communicate with each other. It requires an IPv6 network interface, which could be provided by ethernet, Wi-Fi, or Thread.
It is important to differentiate OpenThread and Thread. OpenThread is an open-source implementation of the Thread standard.
Both technologies are designed to be used (albeit in different ways) in residential settings on the following loose categories of embedded devices:
Embedded devices that need to be able to reliably communicate with each other under adverse conditions, like a power outage or a fire.
Battery-operated embedded devices that need to be able to last for many years without changing or recharging the battery.
Sensor networks for monitoring things like temperature, motion, humidity, etc.
Second Question
The implication of your question is that the two technologies are mutually exclusive, or that they somehow solve similar problems. As the cute naming implies, Thread and Weave are complementary technologies. Weave needs a network interface to communicate with other devices, and Thread provides one.
Thread is like Wi-Fi in this way. Wi-Fi doesn't define the protocols that run over it. For example, just because a smart thermostat and a smart light switch have Wi-Fi radios doesn't mean that they can communicate with each other. It will be a similar situation with devices that have Thread-compatible radios.
Third Question
While there is no particular reason why you would not be able to use Thread or Weave (or both!) to communicate with devices running Android (or any other operating system), the the devil is in the details: there is no one-size-fits-all solution.
That being said, one way is to use IPv6 routing: Thread is based on IPv6, so if you have a Thread border router, you can allow devices on a Wi-Fi network to directly communicate (via IPv6) with devices on the Thread network.
Fourth Question
In addition to the POSIX simulator, the CC2538 is now an officially supported hardware platform. Support for Dialog's SmartBond™ SoC family of chips is currently provided directly by Dialog.
it might help to first better understand Thread and what it is trying to solve. Designed for the home, Thread is an IPv6 networking protocol built on open standards for low-power 802.15.4 mesh networks that can easily and securely connect hundreds of devices to each other and the cloud. This is different than Weave, which is an application protocol. Multiple application protocols can be developed on top of Thread, including Nest Weave. The Thread Group has a nice technical overview of Thread on their site.
Now to your specific questions:
You should use OpenThread if you're looking for an open source low-power, ipv6-based mesh networking protocol to build upon for your home connectivity application protocol
That really depends on what you mean. Any application protocol built on Thread should be compatible at the network layer with OpenThread, assuming they are targeting compatible versions of Thread.
One of the key design goals of Thread is being able to allow the Home Area Network to reliably communicate to the cloud through Border Routers. We demonstrated an Android app controlling a Thread end device from a Android. Here is a video.
You can find a CLI simulator in the /examples folder. At the time of this writing, OpenThread is still rather new - however we expect to see various SoCs officially supported from our silicon launch partners. Watch the repo for more updates.

Choosing between network (Ethernet or WiFi) programmatically

On my mac I have two kinds of networks available - Ethernet, WiFi.
While making a server call, can I somehow control which network channel to use for making the server call? So, before making server call, I want to specify the network channel to be used for that call - Ethernet or WiFi.
How can this be achieved using objective C. I am working on a cocoa application.
I assume both NIC's are connected to Internet (so both have a IP):
I don't think you can solve it within code (not 100% sure). But what you could do is setup some local routes, configuring which traffic goes over what NIC.
Look at the route command ('man route').
This might help you:
https://serverfault.com/questions/100613/public-traffic-to-go-over-1-nic-and-private-traffic-to-use-another-nic
You can modify the routes available with the System Configuration framework. In scutil(8) you can see the routes that are presently installed in the State:/Network/Service/* dictionaries, and in order to manipulate these programmatically you have to us the SCDynamicStore framework, which is C.
However, if you were trying to just do some ad-hoc service on WLAN only, you could use the CoreWLAN framework, which is in Objective-C.

WebRTC - JSEP: cannot connect peer between two different network

I don't know if anybody have issued this, but I wan't to ask. My problem was like this:
I could use video chatting from apprtc.appspot.com using two Chrome tab (which means I call myself). Everything worked well.
I could use apprtc with two different laptop as well, if those laptop were on the same network. I used my university's network behind proxy.
However, apprtc didn't work if I used it with one laptop on modem, and the other on LAN.
Can anybody explain what happened? Is this STUN/ICE problem? Or JSEP?
The public demo includes a STUN server but does not provide a TURN sever because the bandwidth to run a free TURN server is expensive. STUN get thought lots but not all NATs / firewalls but not anywhere near as many as TURN. You might be in a situation where TURN would work (but you don't have a TURN server) but STUN does not.
I've been able to use the demo at http://apprtc.appspot.com/ from behind two different NAT's. So it can at least work in theory; but it's also fairly well known that STUN, TURN and ICE aren't infallible. For starters, if someone has blocked access to the port 19302 (the port of the STUN server that the apprtc demo uses), the firewall traversal will never be able to get started.
The basic troubleshooting step would be to open up the Chrome developer tools (ctrl-shift-i) and look to see if there are any errors in the console. Failing to observe anything interesting there, you'd need to write up your own version of the demo app, this time with better error handling. For instance, the apprtc demo assumes certain things that can't really be taken for granted, for instance, that peerConnection.setLocalDescripton() and peerConnection.setRemoteDescription() will succeed. In production code, you'd really need to implement both success and failure callbacks on those - and that would give you better information about what might be going wrong.
AppRTC uses stun by default. TURN is 'better' (from my understanding), but I recall Justin Uberti saying public TURN servers will likely be misused (or something to that effect).
STUN often fails on enterprise grade subnets because it can't 'cope' with unfriendly NAT addressing.

RabbitMQ - Basic newbie questions

Our scenario: dozens of Windows laptops which are occasionally connected to the network. Need to store simple data records on each laptop, then have these reliably transferred to a service running on the network once connection is available. Considering RabbitMQ on each laptop, feeding data to a "main" RabbitMQ on the network. This is a Fortune 100, and packaging etc is a concern.
Question 1: In general, does Rabbit make sense here? If not, any suggestions for an approach?
Question 2: When I installed on Win I had to manually install Erlang first. Are there packaging/deployment options which are simpler/more friendly? (Their IT people can do all the normal deployment stuff including create win service, but installing Erlang on user machines might raise eyebrows...)
Thanks for any help from those of you who've been there, done that with Rabbit.
Question 1: What you need is a store and forward mechanism. RabbitMQ can be used for that, actually by using the Shovel plug-in to take care of moving messages from the local Rabbit to the remote one (handling reconnection, retries, etc... for you).
Question 2: The answer is related to question 1. RabbitMQ+Shovel is conceptually suitable for your store and forward needs but if, alas, not technologically acceptable, you may want to consider simpler/cruder approaches like... SMTP!
If the Windows laptops are backed by a windows infrastructure, the most logical choice is MSMQ, which offers this "Out-of-the-box"; e.g. store and forward from clients to server(s). Easy to install by policy and administrate.

Best way to simulate a WAN network

Simplified, I have an application where data is intended to flow over the internet between two servers. Ideally, I'd like to test at what point the software ceases to function. At what lowerbound limit (bandwidth, latency, dropped packets) do things stop working to test the reliability of the software.
What I thought I would do was the following:
Setup up 3 machines (VMware instances)
Install the 2 applications on two of the servers.
Setup up the 3rd server to sit between the two machines by doing some sort of magic with Routing and Remote Access on Windows 2003
Install either Traffic Shaper XP or NetLimiter to limit the bandwidth
Run something like TMnetSim Network Simulator to simulate a bad connection.
Does this sound like a good idea or are there easier/better ways of doing this? I'm not that comfortable on Linux and my team mates are even less so.
WANem does exactly this. We have used it both in a virtual machine on the desktop and on a dedicated old pc and it worked great. It can simulate all sorts of broken connectivity.
FreeBSDs ipfw has provisions to simulate links with a given bandwith, latency or error rate. You could use that FreeBSD machine as your machine "in the middle" in your above setup.
You probably can also run at least one of the endpoints on the same machine if you want to reduce the amount of servers involved.
Someone actually packaged up the settings and whatnot necessary for the FreeBSD solution to this problem and they call it DUMMYNET.
It simulates/enforces queue and bandwidth limitations, delays, packet losses, and multipath effects. It also implements a variant of Weighted Fair Queueing called WF2Q+. It can be used on user's workstations, or on FreeBSD machines acting as routers or bridges.
It can simulate exactly what you want, and its free and will boot onto commodity hardware. They even have a canned install of it that is small enough to put on a floppy disk (!) that you can download at that link.
Maybe it is time to learn a bit about Linux because adding a 50ms delay on every outgoing packet can be done in typing just one line:
tc qdisc add dev eth0 root netem delay 50ms
For more see the Linux Traffic Control HOWTO
We had a similar requirement some ten years ago - I'll see if I can recall how we managed it.
If I remember, we wrote a socket proxy program which was controlled by inetd on a UNIX box. This socket would accept connections from a client and open equivalent sessions through to the server. It would then loop, passing messages in both directions.
The way we achieved WAN characteristics was to introduce random delays (with upper and lower limits) in both the connection establishment and the passing of data once the link was up.
It also had the feature to drop the link occasionally as WAN links were less reliable for us than local traffic.
I recall we had to make it threaded to stop the delays from affecting reverse traffic on the link.
There is a very good (and free) Microsoft solution for that, we use it for quite some time and it works great, it can very easily simulate every thing(packet loss, low bandwidth, disconnection, latency....)
This is the best solution i found for a windows environment
More information and a download link can be found here: MARCO blog post
this product has gone some evolution and it is now integrated into visual studio as part of the automation testing, but i found the use of the standalone(that is quite hard to find, so keep a local copy) to work much better. keep in mind that you need at least two computers(or VMs) since you need to pass through a network adapter in order for the application to work its magic.