Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
Developer
Posts: 587
Registered: ‎01-19-2010
My Device: BOLD 9700 OS5.0.0.x on Rogers Canada
My Carrier: Rogers

Java.io.IOException: Tunnel Failed for UDP connection

Hi all,

 

I'm trying to send UDP packets through the simulator to a console I have open. This works fine for the Storm, which I used for most of my development thus far because it's the fastest-loading simulator I have. It turns out, however, that this is one of the few devices I've been instructed to ignore pertaining to my development, so I switched to a plethora of other simulators, but I receive the error in the topic every time I try to send a packet. I am connected to a network with full bars, but I am unable to access web services or send any UDP packets. "In Coverage" is checked, netcat is listening for connections. Basically, all is well in the universe, but nothing's getting through. I saw this same issue in an old post but there was no satisfactory solution. Basically I want to connect a port and send an array of bytes through it without using the MDS, as I've been able to do so thus far with at least one device, and theoretically I shouldn't need it. The only other noteworthy piece of information is that I have the GPS simulation running at all times during these tests, as it's an integral part of the application.

 

Thanks,

~Dom

----------------------------------------------------------------------------
chown -R us ./base
~J!NX
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Java.io.IOException: Tunnel Failed for UDP connection

Not all simulators can do UDP. Try the Curve 8900 simulator that comes with JDE v4.6.1 -- UDP definitely works there. If it doesn't work there for you, then there's probably something wrong.

Developer
Posts: 587
Registered: ‎01-19-2010
My Device: BOLD 9700 OS5.0.0.x on Rogers Canada
My Carrier: Rogers

Re: Java.io.IOException: Tunnel Failed for UDP connection

I've tried this ap on all of the following:

 

  - 8330 Curve
  - 8530 Curve
  - 8830 World Edition
  - 9000 BOLD

  - 9530 Storm
  - 9700 BOLD

 

The only one where I was successfully able to get a connection was the Storm, which doesn't make any sense, by my reconing. Sending a UDP packet isn't exactly a difficult process. That said, though not all of these may be able to make a UDP connection (which is unlikely), they should definitely be able to connect to the internet via the browser whilst in coverage. Again, the Storm is the only one this worked for. Does the Storm have some special significance in this regard?

----------------------------------------------------------------------------
chown -R us ./base
~J!NX
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Java.io.IOException: Tunnel Failed for UDP connection

Are you using Wi-Fi or Carrier TCP/UDP? UDP only works on Wi-Fi and Carrier TCP/UDP (formerly known as Direct TCP) where you need to have the right APN settings on the device. May be you could also post your test code that demonstrates the issue.

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Java.io.IOException: Tunnel Failed for UDP connection

"Tunnel failed" usually means that the IP tunnel through which the OS is trying to send your UDP/IP packets cannot be be estabished or doesn't work in other ways. In the case of Carrier TCP/UDP, the IP tunnel is the one terminating at the GGSN in the carrier's core network. In the case of Wi-Fi, the IP tunnel terminates inside the Wi-Fi stack on the device.

Developer
Posts: 587
Registered: ‎01-19-2010
My Device: BOLD 9700 OS5.0.0.x on Rogers Canada
My Carrier: Rogers

Re: Java.io.IOException: Tunnel Failed for UDP connection

I connect to the server using the following line:

 

conn = (UDPDatagramConnection) Connector
             .open ("datagram://127.0.0.1:2000;3000;");

 

Currently it's just a loopback to an open terminal. Shouldn't be any issue in this regard. The problem seems to lie with the simulators themselves, unless my code for some reason has some Storm-specific structure that I am unaware of. Theoretically my app should run exactly the same on any device of a similar generation at this point, as I have no UI to speak of. I have an MDS simulator, and the JDE is clearly linked to the proper containing directory, but that doesn't seem to have an effect on the final results. The simulators seem unable to open tunnels of any kind; the debugger gives me a lengthy stream of "Such and such application has NO tunnels open" for all of the sample applications that are lodaed onto the simulators. My quandary lies with opening said tunnels so that I can send through a 32-byte packet. They don't need to be open very wide...

----------------------------------------------------------------------------
chown -R us ./base
~J!NX
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Java.io.IOException: Tunnel Failed for UDP connection

1. 127.0.0.1 won't work on actual BlackBerrys as this address cannot be reached neither via Wi-Fi nor via the cellular IP tunnel.

 

2. Drop the trailing semicolon from the URL.

 

3. Try changing the URL to "udp://ip:dstport;srcport/" (the slash at the end may be important sometimes).

Developer
Posts: 587
Registered: ‎01-19-2010
My Device: BOLD 9700 OS5.0.0.x on Rogers Canada
My Carrier: Rogers

Re: Java.io.IOException: Tunnel Failed for UDP connection

1. I'm fully aware of that. I'm not testing it on real Blackberries. I refer back to the purpose of this topic: The simulators aren't working.

 

2. Trailing semicolon shouldn't make a difference, and is completely irrelevent to the issue at hand. I assure you my code is not the issue here -- the simulators cannot make any sort of server connection and/or cannot seem to find the MDS (currently: C:\Program Files\Research In Motion\BlackBerry Email and MDS Services Simulators 4.1.4\MDS).

 

3. If it makes you feel any better I'll change it, but again it shouldn't make a difference.

----------------------------------------------------------------------------
chown -R us ./base
~J!NX
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Java.io.IOException: Tunnel Failed for UDP connection

Have you tried the 8900 simulator that comes with v4.6.1 JDE? Not some arbitrary 8900 simulator, but the one that comes with that JDE...

 

The trailing semicolon matters quite often (probably due to a bug in RIM's code) -- search this forum.

Developer
Posts: 587
Registered: ‎01-19-2010
My Device: BOLD 9700 OS5.0.0.x on Rogers Canada
My Carrier: Rogers

Re: Java.io.IOException: Tunnel Failed for UDP connection

Remember how it works in the Storm? That particular semi-colon changes nothing. I've been programming Java, C++, C#, and various other languages for quite some time. I'm aware of what a syntax error is. I should furthermore point out that that particular line is taken from the UDPDemo that RIM provides, practically unmodified. (It's not like I'm infringing on copyright with a single command) I should furthermore point out that "udp://" and "datagram://" are 100% interchangeable as far as I can tell, as I've tried both in various locations throughout this project. I went with "datagram://" because that's what the sample used, and I figured it wouldn't hurt to be consistent. The SIMULATORS are causing the problems. I've tried every simulator that comes with both the BlackBerry JDE and the BlackBerry plugin for Eclipse, as well as at least 5 that I got from the BlackBerry Developer's Zone. The ONLY one that  successfully sent UDP Packets was the 9530.

 

Current software:

- BlackBerry JDE 4.7.0.41

- Eclipse JDE 3.4.1 with BlackBerry Development plugin  1.0.0.67

 

Current External Simulators:

- 9700

- 9530-Verizon

- 9000

- 8530

- 8300-Rogers

- 8330

- 8830

- Email and MDS simulators (latest release)

 

Current Mood:

- Frustrated.

----------------------------------------------------------------------------
chown -R us ./base
~J!NX