I am currently developing a Blackberry 5.0 application which needs to be able to intercept a SMS message. I am trying to send a SMS to the emulator. I've come accross the suggestion to run two separate instances of the emulator and to send a SMS from the one emulator instance to the other using the SMSDemo sample application on both emulators.
I run the two instances of the emulator from two separate working directories as follows:
"C:\java\blackberry\eclipse\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.36\components\simulator\fledge.exe" /app="C:\java\blackberry\eclipse\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.36\components\simulator\Jvm.dll" /sms-source-port=6000 /sms-destination-port=6001
"C:\java\blackberry\eclipse\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.36\components\simulator\fledge.exe" /app="C:\java\blackberry\eclipse\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.36\components\simulator\Jvm.dll" /sms-source-port=6001 /sms-destination-port=6000
Both instances start up but when I attempt to send a SMS it never arrives at the second emulator.
I've disabled the Windows firewall - no change.
When I netstat for UDP I can see both ports 6000 and 6001 listening.
Any advice would be appreciated.
I have finally found a solution for the problem. Here it is:
Using Wireshark to sniff the UDP broadcast from the emulator I noticed that the destination address is incorrect - its "1.0.0.127". This address is not routable so the datagram sent from the one emulator will never reach the other emulator.
I might have missed it but I cannot see any command line argument to set when launching the emulator to specify the destination address.
I changed my development laptop to use a hard-coded IP address instead of DHCP. I then added 1.0.0.127 as another IP address to my TCP/IP settings. The address is now routable.
Restarted both emulators with no changes to the port settings (/sms-source-port and /sms-destination-port) and it worked fine. I did not need to use the SMSDemo application. I used the normal Blackberry messaging application.
I hope this helps others experiencing this same problem.
Related
I am developing an iOS app which requires sending UDP packets. When I test the app on the simulator, I can receive the packets from another computer. However, when I attached my phone to the computer and run it, the phone does not send out network requests.
I think the problem is that I need to let the app ask permission from the user, but I do not know how to write it.
I am sending UDP packages with using SwiftSocket, and here is my code: https://github.com/lxylxy123456/FGFS-Controller
It turns out that I cannot use an IP Address to request authorization. For my app, I can change the "IP Address" field to "apple.com" or "stackoverflow.com", and grant the APP the permission to access network, and then all data would be transferred successfully (after switching back to my IP Address).
I am trying to trigger an event when a device with a certain MAC address connects to my LAN. Is this possible in IOS? According to some research the device I want to detect (Amazon Dash Button) performs and ARP ping to the router to connect, then triggers a hard coded HTTP request. I want to detect the ping through my IOS app so that I can trigger an event via my phone.
The most helpful resource I have found so far is this repository:
LAN-Scan
However, this is run everytime the user invokes it. Is there a way o constantly scan the local network trigger some code when a new device connects?
Any and all help is appreciated.
I used GCDAsyncUdpSocket to send udp message to discover ssdp service, in iOS reported "No route to host" this error,but there is no problem in the simulator above can be found in service, is that how it happened? I searched a lot of information, but no discovery could help me.
I've run into the same thing. Of course without your source code we can't help you other than to provide vague guesses. I hope you've fixed it by now and if you recall what the problem actually was, please let us know.
Things to check :
Firewall settings on the host. I was trying to receive messages on my mac book and found that Firewall settings can block the port you chose. Firewall is under system preferences on the 3rd tab.
Use apples Reachability class to make sure you've got an active WIFI/Cell connection to the internet. (here : https://developer.apple.com/library/ios/samplecode/Reachability/Listings/Reachability_Reachability_h.html#//apple_ref/doc/uid/DTS40007324-Reachability_Reachability_h-DontLinkElementID_7 )
You can also use other functions in the Reachability class to let you know if the host is reachable before even bothering to open up a socket.
If the host is your mac and the simulator is on the mac, there isn't much of actual network traffic and then when you run on your phone you are actually using real networking. Be aware of, depending on your networking situation, you may need the external IP address of your host (vs the internal network WIFI address e.g. 192.168.1.4 )
Some people have reported a bug where UDP stops working and you get no route to host messages but for some reason turning on and off airplane mode fixes it. Maybe check out their solution (using keep alive messages ever 30 seconds or so to prevent power management from turning off the cell connection). Here is an example : intermittent "No Route to Host" on iOS, flight mode off then on fixes
In case you are developing an App Clip for iOS app, be aware that:
a) Background Session is not supported
b) Multipath is not supported. Setting `multipathServiceType = .handover` on `URLSessionConfiguration` will cause all requests failure due to `No route to host`
I am trying to build an app for iOS that can connect to computers running macOS or windows, and control a few stuff on those computers. Another application will be installed on those computers so that the app on iOS can connect to them. But at first I need to discover those computers in the network that has my app installed and running. What is a good way of doing that? I thought about using broadcasting, multicasting or bonjour. Are there any other options? Which one is best for my situation?
I am planning on doing two different applications for macOS and windows, one with objective c and other with c#, so the networking stuff should be available for both of those. Thanks in advance
The simplest option by far would be to use IP/UDP broadcast packets. The application on the computers (running whatever OS) can all sit there listening on a predefined UDP port (e.g. 9999), and when the iOS device wants to 'scan' the network, it will send out an IP/UDP broadcast packet with the destination port of 9999. Upon receiving the broadcast packet(s), the application on the computers can respond since it now knows the IP address of the iOS device, and you can take things from there.
The cleanest way to handle a computer leaving the network is for the application that is running on the computer to communicate this fact to the iOS device since it already knows the IP address of the iOS device. But if keeping a current list of computers is crucial, then some sort of a polling mechanism is unavoidable because the computers may crash for whatever reason without having the chance to send the bye-bye message.
Multicasting can be utilized as follows: computers periodically send IGMP joins for a predefined multicast group (e.g. 224.1.1.1), and iOS device sends the multicast UDP packet destined to 224.1.1.1 when it wants to 'scan' the network. The multicast UDP packet(s) will be received by the computers since they have already joined the multicast group of 224.1.1.1, and then the computers can start communicating with the iOS device now that the IP address is known. However, this seems overly complex, and does not really offer any advantages. The whole point of using multicast is to save bandwidth, but the amount of bandwidth saved will be minuscule. Unless you are going to send the same data in substantial quantities from the iOS device to all the computers, there is simply no reason to go down this path.
As for Bonjour, unfortunately I am unable to comment as I have no experience with it, but I would still vote for simple broadcasting to keep things platform independent... well, at least on the computers side. :)
Is it possible to build a socket connection between 2 iOS devices connected to the same network (Without net)?
if it's possible .. Is (CocoaAsyncSocket project) useful for me?
I just want to send a message from Device A to Device B which put the app in background .. when Device B receive the message should show notification to return the app to foreground.
It's not for the App Store, so I don't care if Apple would reject the app because of this behavior.
Yes, you can do it, and yes, CocoaAsyncSocket would be useful. If you don't have to worry about the carrier network's firewalls and filters, then you should certainly be able to build a client-server app running on two iOS devices. One opens the server socket to listen, and the other one (the client) connects, via the Wi-Fi network.
Trying searching on Google (e.g. "CocoaAsyncSocket iPhone iOS site:stackoverflow.com") or directly here on Stack Overflow.
Here's somebody who seems to have accomplished this
Another link
And a post from Robbie Hanson himself, referring you to the EchoServer projects in the github repository
EchoServer project
You may have to use a static IP address for the server device (I'm not sure how much control you have over the Wi-Fi network's configuration), or use some other mechanism for letting the two devices discover each other.