BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 03-22-2009, 09:26 PM   #1 (permalink)
New Member
 
Join Date: Mar 2009
Model: 8320
PIN: N/A
Carrier: not any
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help for sending datagram via private wifi network

Please Login to Remove!

There are four url for sending datagram in the example RIMJUDPClient.java

// udp://10.1.0.122:5029;19780/rim.net.gprs
// udp://127.0.0.1:5029;19780/rim.net.gprs : Use This String for Local Testing
// udp://<Public IP>:<UDP Port>;19780/proxy : Use This String With AT&T GPRS Service
// udp://<Public IP>:<UDP Port>;19780/internet3.voicestream.com : Use This String With T-Mobile GPRS Service

However, I want to send datagram via private wifi network, I have tried udp://ip:port1;port2/;interface=wifi, but it doesn't work in device 8320 (v4.2.2.180). the send() throw exception contents "null".
Can you show me an example of url used to create the connection?
Appreciate for any help!!!
Offline  
Old 03-23-2009, 12:38 AM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Feb 2009
Model: 9000
PIN: N/A
Carrier: AT&T
Posts: 16
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've certainly received udp datagrams directly over a wifi connection. I believe I just appended the following to my connection string:
Code:
";interface=wifi;deviceside=true"
We can probably help a little more if you want to post some sample code. You should also note that the 'berry isn't able to either send or receive udp multicast or broadcast messages (much to my distain).
Offline  
Old 03-23-2009, 01:58 AM   #3 (permalink)
New Member
 
Join Date: Mar 2009
Model: 8320
PIN: N/A
Carrier: not any
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi WonderfulRemote, Thanks for your reply!
Is the symbol '/' in your connection string? I noticed in the <<BlackBerry JDE Development Guide>> said that:

Open a datagram connection on a non-GPRS network.
Specify the source port number, including the trailing slash mark.For example, the address for a CDMA network connection would be udp://121.0.0.0:2332;6343/.

And what's the version of your device?

Here is my code for datagram connection, I attach the debugger to device via usb cable, and the code throw out Exception when executing send(), print out "null". Get the same Exception when add '/' to the String host appending after the port.

Code:
                try {
                    DatagramConnection udp_client;
                    Datagram dg_out;
                    host = "udp://192.168.1.101:5009;5010" + ";interface=wifi;deviceside=true";
                    udp_client = (DatagramConnection) Connector.open(host.trim());
                    byte[] data = {65,66,67,68};
                    int len = data.length;    
                    dg_out = udp_client.newDatagram(data,data.length);
                    udp_client.send(dg_out);
                    udp_client.close();
            }catch (Exception e) {
                    System.out.println("UDP Exception:"+e.getMessage());
                }

Last edited by livepanda : 03-23-2009 at 03:02 AM. Reason: paste code
Offline  
Old 03-23-2009, 02:24 PM   #4 (permalink)
Knows Where the Search Button Is
 
Join Date: Feb 2009
Model: 9000
PIN: N/A
Carrier: AT&T
Posts: 16
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

The device I used was a Bold 9000, I built the app with jde 4.6 (eclipse).
I am not in my dev environment so I can't run a test right now, however just looking at your reply the connection string looked a little curious:

Code:
host = "udp://192.168.1.101:5009;5010" + ";interface=wifi;deviceside=true";
I not sure that I understand what the ;5010 is for? Is it a typo?
I would also recommend that you also try using the datagram:// prefix I know it took a couple of permutations to get it working on my device, but if memory serves me I used the datagram:// prefix and casted the resultant object to UDPDatagramConnection.
It was something like the following (again from memory):


Code:
host = "datagram://192.168.1.101:5009 + ";interface=wifi;deviceside=true";
UDPDatagramConnection socket=(UDPDatagramConnection)Connector.open(host);
Offline  
Old 03-24-2009, 12:28 AM   #5 (permalink)
New Member
 
Join Date: Mar 2009
Model: 8320
PIN: N/A
Carrier: not any
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi WonderfulRemote, Thanks for your attention!
I have confirmed that it's the issue of OS's version which below 4.5.0.83.
I upgraded OS of my 8320 from 4.2.2.180 to 4.5.0.124, the bug disappeared!!! No '/', No additional '5010'--dst port, even No ';deviceside=true'. Only ';interface=wifi' is needed. Currently working URL for me:
Code:
host = "udp://192.168.1.101:5009;interface=wifi"
Thanks for your attention again!
Offline  
Old 04-22-2009, 07:34 AM   #6 (permalink)
New Member
 
Join Date: Oct 2008
Model: 7100
PIN: N/A
Carrier: engineer
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default UDP settings needed in device

Hi All,

I am using the Udp connection for sending and receiving the data to and from server.

This is my udp connection line:::::
(UDPDatagramConnection)Connector.open("datagram://:"+port+";interface=wifi;deviceside=true");

Based on this is there any settings needed for real device for hitting the server. Please kindly help on this...

My device is:::::8900 curve. airtel service provider. I am using only the WIFI only.

Regards,
Suresh A
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.