×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    14

    Datagram Connection

    we are developing a server to commnunicate with Midlets for Games .When we use socket some phone emulators do no identify the port (7210).Its ony working in with HttpConnection .
    and our server is not working for Http.Is it possible to use Datagram Connection in MIDP.Datagram Connection is specified in API

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    101
    Current Nokia phones only support HTTP in MIDlets.

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    14

    Datagram Connection

    Thanks for reply

    but when we tested with socket in 7650(Series 60 ) phones its working

    connection.open("socket://serverort");

  4. #4
    Registered User
    Join Date
    May 2003
    Posts
    4
    I tried to connect using datagram, but i'm getting NullPointerException. Are you able to connect using datagram?

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    16
    I have tried also the socket connection on 7650.

    It works... up to a certain point.

    The program I tested opens a bidirectionnel socket
    url= "socket://<host>:<port>";
    c = (StreamConnection) Connector.open(url,Connector.READ_WRITE, false);
    and creates input and output stream.

    there is a button to send data to the server, and a thread to receive data from the server and display them.

    What happens is : the midlet receives data from the server, displays them OK, but as soon as the midlet tries to send data to the server, it looks like the socket is blocked : data are never received on the server side, and data sent by the server are no more displayed on the phone.

  6. #6
    Registered User
    Join Date
    Jun 2003
    Posts
    24

    j2me midp version

    could u plz tell me what version of java MIDP u using for Socket Connection
    I would like to know if any version of nokia do have support for tcp or datagram socket support in J2ME Midp.

    and do Midp 1.0 has tcp or udp socket support

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    16
    to barrylyer :

    A phone needs not provide tcp socket or udp datagram support in order to be MIDP 1.0 compliant. If you want to create a socket connection, you have to do the following :
    url= "socket://<host>:<port>";
    c = (StreamConnection) Connector.open(url,Connector.READ_WRITE, false);

    On phones that support socket connections (e.g. nokia 7650) this works. If however the phone does not support socket, Connector.open(...) will just throw a "socket not supported" exception.

  8. #8
    Registered User
    Join Date
    Jun 2003
    Posts
    24

    Socket Connection

    Hi gerold thanx for your reply.
    But, i still have a doubt on this.

    Why is it that , there are different versions of sdk or MIDP/CLDC versions in each model of phone?

    I mean to say that , is there any standard version of java which i can follow for different phones.

    Im currently using java wireless toolkit 2.0 and 1.0.4_01 from sun.

    If i compile my code in 2.0 which uses java MIDP 2.0 i get no problem. But the same code when compiled under 1.0.4_01 which uses java MIDP 1.0 shows compilation errors in Socket.

    How can choose the SDK or the exact version of MIDP which has support for sockets.

    And is there and version of MIDP 1.0.x which has support for Socket.

  9. #9
    Registered User
    Join Date
    Mar 2003
    Posts
    16
    The code I put in my previous message does compile with WTK under 1.0.4_01 , which I am using for developments .

    The ServerSocketConnection and DatagramConnection classes are not part of MIDP1, only of MIDP2, however I did not use these classes. I wrote :

    c = (StreamConnection) Connector.open(url,Connector.READ_WRITE, false);

    where url starts with "socket://..."

    This compiles OK, and at runtime phones that do not implement sockets throw an exception.

    Hope this helps.
    AG

  10. #10
    Registered User
    Join Date
    Jun 2003
    Posts
    24

    Thanx

    Hi gerodol
    Thanx a lot ya
    Hope im getting it right.

  11. #11
    Registered User
    Join Date
    Oct 2003
    Posts
    120

    hi guys

    hi i too facing the same probelm ,i have my J2SE Datagram server running on port number 17000,and the app is running on emualotr is working fine when it local address as i chnage the address to the static address it never responds to that ,

    I see that meesage from clients nevers reaches the server and no error is traced at all on the client side too.

    So can anyone help me out on this,please.

  12. #12
    Registered User
    Join Date
    Mar 2007
    Posts
    1

    Smile Re: Datagram Connection

    I had a problem my server not receiving data sent from the client running on the phone (But the same client was working fine with emulator). flushing data after writing to the buffer did work for me

  13. #13
    Registered User
    Join Date
    May 2008
    Posts
    3

    Re: Datagram Connection

    I have the same problem, I have a datagram server application and a midlet which sends datagrams to server. In the emulator everithig is ok but when I install the midlet on my Nokia N95, no data reach to the server. The ip addres is ok, no firewalls,???
    CLDC 1.1 Mido 2.1.
    what do you mean when you say flushing data. There is no flush method on datagram connection nor Datagram????
    Last edited by fravemel; 2008-05-08 at 14:35.

  14. #14
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: Datagram Connection

    You should flush() the OutputStream instance you use to send data to server.

    Pit

  15. #15
    Registered User
    Join Date
    Sep 2007
    Posts
    18

    Re: Datagram Connection

    On the N95 an IAP has to be defined before your network communications are allowed to go through...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×