Tunnel Failed, BlackBerry Curve 8900 - blackberry

I have a MIDlet that sends TCP messages over the network to a server residing on the same internal network.
Whenever I try to connect using this line:
StreamConnection writeSock = (StreamConnection) Connector.open("socket://" + serverIp + ":" + serverPort, Connector.READ_WRITE);
I get an error saying
Tunnel Failed
According to netstat, the port on which the server is set to listen is actually open and in listening mode. I printed the IP and Port values from the mobile application and they seem to be correct.
I have looked on the internet and many people solved the problem by setting up their APN details. I did such a thing, and the problem still persists. I have no clue what I have to do next. Just for checking purposes, these are the APN details I entered:
APN: internet
Username for APN: internet
Password for APN: internet
My carrier is Vodafone Malta. Just as a side note, this part of the application works on an emulator. I am using a default emulator (DefaultFxPhone1) that comes with the j2me package, and I am using Netbeans 6.8.
I have tried enabling and disabling the firewall, but to no avail.
Thanks in advance.

You may also want to consider trying adding the ";deviceside=true" parameter to the end of the connection string. The default is false, which implies MDS (BES infrastructure). To do direct TCP over the APN, you need to set it to true.

"Tunnel failed" means that your APN is not configured properly in the device. You may need to do some Googling to find the proper APN for your carrier.

Related

"No route to host" error on iOS

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`

Blackberry SMS interception, sending an SMS to the emulator

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.

BlackBerry OS 6: IOException:"peer refused the connection" on specified url

Calling
Connector.open("http://MySpecifiedURL.com;deviceside=true;apn=rim.net.gprs");
Throws IOException: "peer refused the connection".
This happens only with few specifies URLs, that used for web services and only on BlackBerry OS 6, on other OS versions (5.0 and 4.*) and with other URLs everything works correctly. Can somebody help me with understanding why this happens?
A "peer refused the connection" error occurs when the server doesn't like something about the connection, i.e. you didn't supply the right userid/password to the APN, or there's nothing listening at that port. My first try would be to drop the apn= part of the connection string.
But if I were you, I would switch to using Versatile Monkey's networking helper class which will find the best TCP connection path for the device, regardless of OS version. It will let you handle the cases where devices are paired with a BES or not, if Wi-Fi is available, etc. It's really easy to use and solves a lot of connectivity problems that BB developers face given the mix of devices out there with BES, BIS, Wi-Fi, etc.
The definitive answer to this subject I found it in "Apress Begining Blackberry Development Nov.2009".
From page 186 to 190 more or less... they throw out a perfectly written code for this... you invoke this Method they define and it will return the extra parameters needed to make a proper request depending on the network availability.
I cannot paste the code here since that would be illegal.
Cheers!.

getting IOException : Peer refused the connection (BlackBerry)

Can anyone tell me why i am getting this IOException:smileytongue:eer refused the connection??? I was testing my application yesterday it was working fine..but today when i opened it i cannot log int my application...i cannot login from the simulator.
.i hve tried appending ";deviceside=true" , ";deviceside=false" and removing it from the url..but nothing seems to work even on simulator...Iwas able to login until yesterday...no change in the code has been made...
The login url is Https url..but i dont think that may be the issue since i was able to access it till yesterdey...
Can any one help..??
I'd double check that the server you are talking to is still up (can you connect to it from a browser on your computer?) and also ensure that the Windows Firewall is not blocking traffic from the simulator. Also, unless you're just using Direct TCP and/or Wi-Fi, make sure that MDS simulator is up and running BEFORE you launch the simulator.

Can I monitor traffic on my Incoming Dialup connection using Wireshark?

I am trying to create a RAS server in XP Pro. The idea is to log in to this server via a dialup connection. I have set up a new network connection via the New Connect Wizard in XP - according to this tutorial on techrepublic.
I am sure that the modem and the connection is working, I have tested it.
However, I want to monitor incoming network traffic on this connection. So I thought I would use Wireshark. The problem is that Wireshark does not list this incoming connection on the front page. It lists all my other network connections, ( e.g. my ethernet connection ) but not this one.
Whats the best way to monitor traffic on this connection?
Wireshark should be able to capture the traffic on your connection. I would check the protocol you're using for communication and make sure that Wireshark is monitoring those protocols. Also, I would make sure that Wireshark is actually capturing traffic on your dial up device. It sounds like it's currently monitoring your NIC card, not your modem.
I recently found Microsoft Network Monitor and it has ability to sniff on dialup adapter with Vista or Win7 as OS. Works great!
According to this Wireshark wiki page, you must use Winpcp 3.1 to be able to capture traffic on dial up modems.

Resources