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
Developer
Posts: 402
Registered: ‎11-26-2010
My Device: Torch
Accepted Solution

UDP connections over 3G

I am trying to create UDP connection over 3G but I am getting IOException: APN not specified.

Now I have read all the threads and tutorials and I am trying all the ways suggested in these tutorials and I am using the correct APN for my carrier. I believe I am creating the connections strings correctly and the app works with WIFI but if I disable the wifi it tries with 3G and simply throws the IOException.

 

I am testing on a Bold 9780 with OS6.

 

I was wondering if there is possible OS/device limitation for UDP over 3G or some sort of carrier limitation.

 

I can provide the code I am using but still I would like to know if there is some sort of known issue with this.

----------------------------------------------------------------------
Press the button to give kudos if I helped you :smileyhappy:
Contributor
Posts: 34
Registered: ‎01-12-2012
My Device: Torch 9810, Playbook 32

Re: UDP connections over 3G

Hi dx22,

 

Can you show the udp connection string?

 

marcwlux



----------------------------------------------------------------------------------------------
Click "Accept as Solution" if your problem is solved. To give thanks, click thumbs up
Developer
Posts: 16,612
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: UDP connections over 3G

just to clairfy, an APN is never used over wifi.
for a direct tcp connection you have to specify the APN in the connection suffix, see the network diagnostic tool or peters connection code for samples.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 402
Registered: ‎11-26-2010
My Device: Torch

Re: UDP connections over 3G

@simon_hain - I am not using apn for wifi. I will try the tool too.

 

Here are all the urls I am trying(with disabled wifi network):

 

udp://:1234
udp://:1234;deviceside=true
udp://:1234/wap-gprs.mtel.bg
udp://:1234;deviceside=true;apn=wap-gprs.mtel.bg
udp://:1234/blackberry.net
udp://:1234;deviceside=true;apn=blackberry.net
udp://:1234;deviceside=true;ConnectionUID=WAP2 trans

 

 As you can see I am opening the UDP connection in server mode on port 1234

----------------------------------------------------------------------
Press the button to give kudos if I helped you :smileyhappy:
Contributor
Posts: 34
Registered: ‎01-12-2012
My Device: Torch 9810, Playbook 32

Re: UDP connections over 3G

example:

 

httpTest = (HttpConnection) Connector.open(

"http://server.com;deviceside=true;apn=apn;TunnelAuthUsername=user;TunnelAuthPassword=xyz")

 

marcwlux



----------------------------------------------------------------------------------------------
Click "Accept as Solution" if your problem is solved. To give thanks, click thumbs up
Contributor
Posts: 34
Registered: ‎01-12-2012
My Device: Torch 9810, Playbook 32

Re: UDP connections over 3G

 

 

 

  ("udp://<host>:<dest_port>[;<src_port>]/<apn>[|<type>][;tunnelauthusername=<apn username>;tunnelauthpassword=<apn password>]");
 

where:

  • host is the host address in dotted ASCII-decimal format. Host address can be specified in FQDN format or as an IP address
  • dest_port is the port to send to at the host address (optional for receiving)
  • src_port is the local source port (optional)
  • apn is the network APN in string format
  • type specifies the connection type (UDP)
  • apn username is the APN authentication username in string format (optional if APN requires authentication)
  • apn password is the APN authentication password in string format (optional if APN requires authentication)

dest_port must be specified in order to send data on this connection. If src_port is not specified then it is set to the same value as dest_port by default.

If the connection is to be used to receive data then src_port must be specified. dest_port can be excluded on inbound connections allowing the connection to receive datagrams from all destination ports.

Note: When testing your applications within the RIM Simulator, you must use the following command line switch to open a port for listening:

 

  /data-port=<src_port>
 

If you attempt to send a datagram on a UDP connection and you are not listening on src_port then an IOException will be thrown.

Note: The handheld's user can select the default UDP connection behaviour; you can override ths behaviour with the previous described parameters.

Input and output streams can be acquired using the openInputStream and openOutputStream methods.



----------------------------------------------------------------------------------------------
Click "Accept as Solution" if your problem is solved. To give thanks, click thumbs up
Developer
Posts: 402
Registered: ‎11-26-2010
My Device: Torch

Re: UDP connections over 3G

@marcwlux - thanks it seems to work well. 

 

It turned out that if I want to open UDP connection in server mode on local port 1234 I have to do it like this:

- for wifi: udp://:1234;deviceside=false;interface=wifi

- for 3g: udp://;1234;deviceside=true;apn=blackberry.net

 

Note the difference in : and ; . When I tried to open it for wifi using ; instead of : I got IOException. 

Hope this is helpful for someone.

----------------------------------------------------------------------
Press the button to give kudos if I helped you :smileyhappy: