×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    39

    socket and datagram problem

    I am trying to test connections over socket and datagram with a code on 6680 and also code on server side.

    I am cheking the all four possibilities of the mobile device (socket client/server, datagram client/server). I am connected with internet apn, and checked my ip from ripe database, it seems to be a real ip.

    Mobile device successfully sends a datagram packet and server receives it. However;
    1) Mobile device sends data over the socket (no error/exception), but this data is not received on the server.
    2) Mobile device listens on socket or datagram (again no error/exception), but the packets I have sent from server cannot be received by the mobile device.

    Corresponding j2me codes -without declerations etc- are like that:

    socket client:

    socketConnection = (SocketConnection) Connector.open("socket://" + addr + ":6666", Connector.READ_WRITE, false);
    socketConnection.openDataOutputStream().writeUTF("test");

    datagram client:

    connection = (UDPDatagramConnection) Connector.open("datagram://" + addr + ":6666");
    Datagram datagram = connection.newDatagram(connection.getMaximumLength());
    datagram.reset();
    datagram.writeUTF("test");
    connection.send(datagram);

    socket server:

    serverSocketConnection = (ServerSocketConnection) Connector.open("socket://:6666", Connector.READ_WRITE, false);
    socketConnection = (SocketConnection) serverSocketConnection.acceptAndOpen();
    socketConnection.openDataInputStream().readUTF();

    datagram server:

    connection = (UDPDatagramConnection) Connector.open("datagram://:6666");
    Datagram datagram = connection.newDatagram(connection.getMaximumLength());
    connection.receive(datagram);
    datagram.readUTF();

    Any ideas ? Thanks in advance.

    Mete

  2. #2
    Registered User
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,884

    Re: socket and datagram problem

    Hi metebalci,

    "1) Mobile device sends data over the socket (no error/exception), but this data is not received on the server.
    2) Mobile device listens on socket or datagram (again no error/exception), but the packets I have sent from server cannot be received by the mobile device."


    Are you sure your pperator supports socket and datagram connections? You should check that and also the available ports.

    HTH!

    BR,

    Juarez Jr

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    39

    Re: socket and datagram problem

    Hi Juarez Jr.,

    Then I took the message from your reply as there is nothing wrong with what I am doing, there must be external reasons, e.g. network, device, available ports on os.

    I will check the network and try it on other devices and with different port numbers.

    Thank you.

    Mete

Similar Threads

  1. Datagram problem on 6020 (MIDP 2.0)
    By sipshakers in forum Mobile Java General
    Replies: 23
    Last Post: 2007-06-26, 14:33
  2. Occasional long stalls for socket and datagram connections
    By joker807 in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2006-07-17, 20:50
  3. Sample code which uses the Push Registry with socket socket and datagram connections
    By mukteshwar in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2006-04-12, 08:40
  4. Push registry with datagram or socket
    By kakgul in forum Mobile Java General
    Replies: 3
    Last Post: 2004-03-31, 14:57
  5. Creating datagram socket connections with nokia phone
    By Curious_rf in forum Mobile Java General
    Replies: 0
    Last Post: 2004-03-01, 16:45

Posting Permissions

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