Discussion Board

Results 1 to 2 of 2

Threaded View

  1. #1
    Registered User
    Join Date
    Sep 2008

    which socket should i use for receiving packets

    Dear All,
    am facing a problem with my code, am trying to initiate an RTP session. I succeeded with implementation of SIP authentication and registry but i cannot get the RTP steam ?
    i would appreciate if someone can review my code and pinpoint the errors am facing.
    Enclosed both Class for the RTP and the error am getting.
    and would be more appreciated if someone can pinpoint a workable sourcecode or document of a complete SIP and RTP under JAVA J2ME.

    part of the code:

    package sip_server2;

    //package com.ctimn;

    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;

    public class SocketListener extends Thread{

    private Form outputForm;
    private boolean shutdownFlag = false;
    private StreamConnectionNotifier notifier;

    public SocketListener(Form outputForm){
    this.outputForm = outputForm;

    private StreamConnectionNotifier createNotifier() throws IOException {
    return (StreamConnectionNotifier)
    Connector.open("socket://", Connector.READ_WRITE, true);

    port list i have been Tried
    // "sip://1006@"

    public void run(){

    System.out.println("socketListener is working");
    String dataIn = null;
    String dataOut = null;
    int counter = 1;
    StringItem item = new StringItem("Listening to Socket", "");
    StreamConnection connection = null;
    try {
    notifier = createNotifier();
    while (true) {
    try {
    connection = notifier.acceptAndOpen();
    } catch (InterruptedIOException x){
    if (shutdownFlag){
    } else {
    notifier = createNotifier();
    catch(Exception e){ System.out.println("there is no error"+e.getMessage()) ;

    DataInputStream is = connection.openDataInputStream();
    DataOutputStream os = connection.openDataOutputStream();
    try {
    dataIn = is.readUTF();
    item = new StringItem("Msg: ", "'"+dataIn+"'");
    dataOut = "Message " + counter + " from the server.";
    } finally {

    System.out.println("finaly try");
    } catch (IOException x) {
    System.out.println("Problems sending or receiving data.");
    // catch(Exception e){
    // System.out.println("there is no error"+e.getMessage()) ;

    // }

    public void shutdown(){
    shutdownFlag = true;
    //Java 2 Micro Edition
    //James P. White and David A. Hemphill
    //ISBN: 1930110332

    The Exeption:

    Problems sending or receiving data.
    TCP open
    javax.microedition.io.ConnectionNotFoundException: TCP open
    at com.sun.midp.io.j2me.socket.Protocol.connect(Protocol.java:216)
    at com.sun.midp.io.ConnectionBaseAdapter.openPrim(ConnectionBaseAdapter.java:103)
    at com.sun.midp.io.j2me.socket.Protocol.openPrim(+108)
    at javax.microedition.io.Connector.openPrim(Connector.java:329)
    at javax.microedition.io.Connector.open(Connector.java:222)
    at sip_server2.SocketListener.createNotifier(SocketListener.java:22)
    at sip_server2.SocketListener.run(SocketListener.java:43)
    Last edited by ahmad_aljallad; 2008-10-14 at 07:03.

Similar Threads

  1. SOCKET PROGRAMMING: Client can not connect to server...
    By simbiyan in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2007-04-22, 20:00
  2. Socket and big packets
    By arachidyl in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2006-04-08, 12:45
  3. problem in persistant socket connection
    By poms4symbian in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2006-01-03, 13:23
  4. Socket problem
    By defragger in forum Symbian
    Replies: 0
    Last Post: 2005-08-25, 08:16

Posting Permissions

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