BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-22-2009, 07:35 AM   #1 (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 Any settings needed for Udp connection

Please Login to Remove!

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  
Old 04-22-2009, 08:31 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

You have, I think, mixed URL formats. I've only tinkered with UDP a bit but was able to use the ECHO protocol by establishing a listen thread and connection using:

Code:
class UDPThread extends Thread
{
    public boolean  loop;
    DatagramConnection  dc;
    
    private UDPScreen   screen;
    
    UDPThread(UDPScreen scr)
    {
        screen = scr;
    }
    
    public void run()
    {
        loop = true;
        
        try
        {
            dc = (DatagramConnection)Connector.open("udp://:7/");
            
            while (loop)
            {
                Datagram d = dc.newDatagram(4096);
                dc.receive(d);
                String payload = new String(d.getData());
                System.out.println("Datagram received: " + payload);
            }
        }
        catch (Exception e)
        {
            System.out.println(e.toString());
        }
    }

    public void sendDatagram(String host, String payload)
    {
        try
        {
            Datagram d = dc.newDatagram(payload.getBytes(), payload.length(), "datagram://"+host+":7");
            dc.send(d);
        }
        catch (Exception e)
        {
            System.out.println(e.toString());
        }
    }
    
}
So, to send a datagram you need to specify a destination host.
__________________
My other Blackberry is a PlayBook.

Last edited by hrbuckley : 04-22-2009 at 08:33 AM.
Offline  
Old 04-24-2009, 03:20 AM   #3 (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

Hi hrbuckley,

Thanks for the reply. Here Actually i am using the MJSIP source code. There they used UdpPAcket, UdpSocket class. In UDp socket data should be send to the server, and receive the data from server.

Actually same code working in the WTk. and i got the response 200ok for SIP registration.

Blackberry JDE: Now i am testing thorugh the Blackberry Jde and through emulator or Blackberry Curve Device 8900. Here its not hitting the server.
here i chenged the scoket, Udpdatagram connection url's like::::::

a.(UDPDatagramConnection)Connector.open("datagram://:"+port+";interface=wifi;deviceside=true");

b. (ServerSocketConnection) Connector.open("socket://:"+";interface=wifi;deviceside=true");

But not hitting the server. Here i need to change any settings in the device or any settigs in the emulator. Please help me on this. This was very important for my job.

please..


Regards,
Suresh A
Offline  
Old 04-24-2009, 08:28 AM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

Unfortunately no experience or knowledge of SIP here.

There are two things I notice:
1) your datagram connector does not specify a destination host. In my example I set this when creating the datagram to send, I assume you are doing something similar.

2) your server socket connection does not specify a receiver port. When I was playing with UDP I initially only coded to send datagrams but I got an error specifying that I could not send a datagram to a port (in my case 7) without listening for datagrams on that port. I also found that if I tried to create two connections (one to send, one to receive) the second open failed due to the port already in use. That lead me to the code above where only one connection is opened, and it is used to send and receive, the receive side in its own thread.
__________________
My other Blackberry is a PlayBook.
Offline  
Old 04-26-2009, 06:38 PM   #5 (permalink)
New Member
 
Join Date: Apr 2009
Model: 9000
PIN: N/A
Carrier: ATT
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, hrbuckley -

Using your code example with the 9000 simulator in JDE 4.6.1, I succeeded in sending UDP packets through the Fledge Network to hosts on my LAN, but when I downloaded the app to my Bold, and tried to use wi-fi (specifying ;interface=wifi;deviceside=true), I was not able even to open the connection. Would get a "tunnel failed" exception. Have you had any luck with using wi-fi?

public void start()
{
try
{
dc = (UDPDatagramConnection) Connector.open("udp://:" + iPort + "interface=wifi;deviceside=true/");

r = new Reader();
r.start();

}
catch (Exception e)
{
Debug.fail(e);
}
}
Offline  
Old 04-26-2009, 08:31 PM   #6 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

My Wi-Fi is always on, but I didn't use interface=wifi in my tests. I will give it a try when I have time, in meetings tomorrow :(
__________________
My other Blackberry is a PlayBook.
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.