How to send OSC commands from iPad/iPhone over the Internet (not Wi-Fi) - iphone

I am building an Arduino based servo driver that I want to control with OSC commands from my iPad over the Internet.
Is it possible to send OSC commands over 3G / UMTS with my iPad or iPhone to control a device? So I will not be limited by the router's range when I send OSC commands to the controller when both devices are part of the same Wi-Fi network.
It seems that the applications I downloaded (TouchOSC, iOSC) can only send OSC data over Wi-Fi, however I'd like to send the commands over the Internet (with port forwarding settings in my router).

I would get one of these. Look ma, no wi-fi :)

OSC typically uses UDP (User Datagram Protocol), even if some newer OSC implementations also allow TCP/IP messaging (also see Difference between TCP and UDP?).
Unfortunately (as far as I know), UDP does not work over 3G, which seems to be your problem. In other words: two mobile devices cannot talk to each other on a cellular network. So it has nothing to do with OSC apps not being able to do this, it's just not available from the cellular network.
However (I think, not tested), I see two workarounds here:
try to use TCP/IP instead of UDP to send your OSC packets
if you need UDP on the Arduino side, you could use a server in-between

Do port forwarding on your router to forward port x to the Arduino, and then use the IP address from whatsmyip.com and use that one in the touchOSC app when inputting the IP address. That may work.

Related

Communication Between ESP8266-01 and NUCLEO-F030R8

I've been tasked with figuring out how to get a mobile app to communicate with an MCU then in turn control a stepper motor. Right now I'm trying to get the WiFi module (ESP8266-01) and MCU (NUCLEO-F030R8) to play nice with each other. The catch is I have little to no experience and no education in this field. The closest experience I have is simple Arduino sketches from years ago (IE photo-resistor values driving a stepper motor) and making desktop applications with C#. I am using STM32CubeIDE but if there's a better option I can switch to that.
What I would very much like help on is send and receive simple data between a smartphone and the MCU via the WiFi module. I've read through documentation and other questions but still don't exactly know where to start.
I understand this is probably a large topic in its own right and a short blurb on the internet won't do it (and undoubtedly its multiple subcategories) justice. But I might as well ask.
Sorry if this is too much and thank you in advance.
This project would involve making the following connections.
The UART connection between STM32 and ESP8266.
The WiFi connection between ESP8266 and the mobile.
The application layer protocol between ESP8266 and the application running on the mobile.
For 1, you can actually program the ESP8266 using Arduino IDE and simply connect the UART TX/RX pins of ESP8266 with RX/TX pins of STM32 respectively. You can create a test project in which ESP8266 sends data to STM32 over UART to verify this connection.
For 2, you need to consider the wifi network mode i.e identify whether the wifi connection is going to be ad-hoc (mobile connects to ESP8266 directly) or in infrastructure mode (mobile and ESP8266 connected via a shared access point). You can configure the ESP8266 in both modes. You just have to program the SSID and password of the Wifi network in the ESP8266 (in case of ad-hoc, it is the SSID of the network advertised by ESP8266 and in the infrastructure mode, it is the SSID of the common AP). This wifi functionality is also easily programmable in Arduino IDE for ESP8266.
Finally, once the physical connection has been established between the ESP8266 and mobile device, you need an application-level protocol to connect the application running on the mobile with the ESP8266. You can either use socket connection between ESP8266 and mobile application or use a higher-level communication protocol for IoT devices like MQTT, which is also available in the Arduino IDE.
Final connection diagram could be something like this:
application -> mqtt msgs -> wifi packets -> esp8266 recv pkts -> parse mqtt msgs -> forward data to STM32 over UART

kamailio imsdroid one way audio is clear the other way just wind and jitter sound

I have installed Kamailio as sip server/registrar and using default config.
I have this situation:
mobile cleint using IMSdroid (extension 100)
windows client using Linphone (extension 300)
Register satus: both clients register successfuly
Both clients get connected to kamailio using my Wireless WIFI modem.
I dial (from IMSdroid) to linphone:
Both ring OK.
Audio heard in IMSdroid is OK.
Audio heard in windows linphone is just wind sound and jitter (or train sound, when I speak louder it gets louder)
Video is ok in both sides (both clients show video clearly)
Both clients get connected to kamailio (public internet IP)
What the problem is from?
You say both softphones and Kamailio are using public IP addresses, if you don't force RTP relaying with rtpproxy (or other similar application), then the RTP streams are sent directly between the softphones.
It might be a bug of the softphone, a problem with the network or audio card, a misconfigured local firewall or maybe the carrier is blocking VoIP.
Try to use other softphone, like Jitsi or X-Lite and see if you get same problems.

Connect() from ios to ios device in same subnet

I develop IOS app, which needs to make standard TCP connection from one iPhone(or iPod) to another. Connection works well between apps on simulator and device, as well as between two simulators.
Application uses posix connect() and I have to stick to this method, because other modules are pure C.
When invoking connect() application blocks, and after timeout error is returned.
The communication is via wifi in LAN
I've sniffed the traffic and encountered, that after connecting to simulator, device sends ARP and after answer, standard TCP handshake proceeds and session is made.
Same case with iPhone<>iPhone stops after ARP request, because another iPhone doesn't respond to it. Moreover iOS sends only gratuitous ARP (announces it's mac ip pair). My MAC seems like proceeding this request, because its ARP table has iPhone record, it doesn't work for another iPhone.
I've tried bonjour service, but it also works only with simulator <> device.
My question:
Is there any way to allow such communication? Is it possible it is problem with my iPhones only? Is there any explicit way to tell OS to send response for arps, or is it somehow blocked for traffic ios<>ios communication.
Not sure if this will help, but I am working on a project that is doing something similar with devices announcing themselves on a network. We are using SSDP to send out an alive request from one device and other devices are listening on the multicast address and port. Once each device receives the alive, it sends out a response with all if its pertinent information, including IP Address and port. Unfortunately, SSDP is a send and forget type of protocol, so there are issues there. We use the IP Address and port information to send messages directly to each device.
Again, not sure if this helps in your situation, but I've seen this work very well so far.

Using iPhone as a TCP and UDP server - open ports?

I need to send and get packets via UDP and TCP in iPhones and the server. But, I figured that if I wanna send packets to a client (iPhone), he is... A kinda server.
So, let's say I'm sending and getting packets to iPhone via the port 2347. Do I need to open the port on the iPhone or something like that? Is there any Firewall built-in to the iPhone?
No firewall on the iPhone. However, 99% of the time, the phone will not have a publicly accessible IP. It may be on wifi behind a router, or it may be on the cellular network most probably behind a NAT pool. Either way, you don't have access to any of those pieces of equipment, nor do your users in the cellular context (and potentially some cases of wifi usage). Think about doing this another way.
There is no firewall on the iPhone by default. Provided you don't need the iPhone to act as a server, i.e., bind a port, you can have the server send packets back to the iPhone using the information in which they were received, i.e., IP and port, using the protocol of your choosing, e.g., TCP or UDP.

Is it possible to connect a socket between two mobile devices (iPhones) over the internet?

Is it possible to connect a socket between two mobile devices (iPhones) over the internet?
I am trying to discover the IP of each device and connect directly. I know it can be done with Bonjour but that only works on local networks. I need a high speed connection between two devices over the internet.
Thanks.
If you had both the IP's and they were both routable, it should be possible. I'm not sure though if the IP's given out by the 3G network are routable. If you are using WIFI, the IP you get is almost certainly not routable. Assuming you have a routable IP though, it should be possible.
The trick is just discovering the IP of the other device. The best way to do that would probably be to have each device register its IP with a web service when your app starts up, then query that service to find the IPs of other devices.
It might get a bit tricky managing "unregistering" IPs when the app is closed or when an IP changes though, but it should be doable.
ETA:
If you have a server that they can both connect to, you should be able to implement a solution using that server (i.e. without the phones actually directly connecting to each other). This would avoid the issue of having routable IPs for the phones.
As for how to bridge the sockets together - your server program would basicly work like an old-school phone switchboard operator. You'd have some kind of registration & discovery protocol built into the server software that would allow a phone to register itself with the server, query a list of the other phones currently connected to the server, indicate which phone it wants to talk to, and accept connections from other phones.
Once it knows who wants to talk to whom, your server software would connect the two together by reading from one phone's socket and writing that data to the other phone's socket.
Only a suggestion, but if you can get each of them to connect to a third site, you'll then know the address of each. Send the address of phone A to phone B (and/or phone B to phone A) and then have them connect as you see fit.
Have you looked through all the 3.0 features? Specifically peer networking (the existence of which is public).
WiFi routers often have a feature called "Port Triggering" which allows internal hosts (in this case an iPhone) to inform the router that they would like to have a connections on particular port forwarded to them. I have no idea if the iPhone supports this protocol.
For IP lookup you may consider using DynamicDNS if the two hosts are known ahead of time OR as stated above a custom web service if they are not (i.e. friends exchanging hostnames vs. strangers discovering each other)
This is an old thread, but I just came across it. You could use a STUN server (or NAT-PMP) to get the public IP address/port combo and then SMS it over to the other phone. So long as you open a listening port on the first device, then your second device can just connect directly using the publi IP address/port you sent to it in the SMS (SMS push registry can automatically wake up your app on the second device to do this)
I have run into this issue with an app I was developing. I was trying to connect to a PC cell card from an iPhone. The problem is that AT&T doesn't enable mobile termination for iPhones so it is physically impossible for two phones on an AT&T network to connect to one another. This is straight from an AT&T antenna engineer.
I was able to get this to work by having the iPhone VPN into a server and then connect to the PC cell card but other than that, it wouldn't work.
I have a very strong feeling (but no evidence) that the iPhone address is going to be non-routable. Of course it actually depends on the operator but AT&T give out 10.x.x.x addresses.
Apple have sample (desktop) code that uses Bonjour to implement portmapping on a WiFi router that supports UnPnP.