Multiple socket connections with MIDP

dear experts,
I have a simple problem and I hope someone can help me to solve it.
I need to open a socket connection from multiple MIDlets on the same port.
This error occours when I try to make a socket push registration from the second (or third, or fourth...) midlet (I'm able to connect to the socket correctly from the first midlet that makes a push registration):
PushProcessor.run Exceptionjava.io.IOException: ServerSocket Open
java.io.IOException: ServerSocket Open
     at com.sun.midp.io.j2me.serversocket.Socket.open(+39)
     at com.sun.midp.io.j2me.socket.Protocol.openPrim(+127)
     at javax.microedition.io.Connector.openPrim(+121)
     at javax.microedition.io.Connector.open(+15)
     at javax.microedition.io.Connector.open(+6)
     at javax.microedition.io.Connector.open(+5)
     at it.myprj.midp.BasicPushMIDlet$PushProcessor.run(+16)
I would know if push registry API allows to have multiple connection on the same socket port.
any help is appreciated!
giovanni

in my opinion,
due to the fact when an app binds one port and a second app tries to bind the same (@same time) there will ever be a exception (from my point of view)!
an no i think that push registry cant register two apps on same port (eg datagram://5060)
hope this helps
chris

Similar Messages

  • Problem with socket connection in midp 2.0

    hello everyone.
    I'm new one in j2me and I am learning socket connection in j2me. I'm using basic socket,datagram example wich is come with sun java wireless toolkit 2.5. for it i wrote small socket server program on c# and tested it example on my pc and its working fine. also socket server from another computer via internet working fine. But when i instal this socket example into my phone on nokia n78 (Also on nokia 5800) it's not working didn't connect to socket server.. On phone I'm using wi-fi internet. Can anybody help me with this problem? I hear it's need to modify manifest file and set appreciate pressions like this
    MIDlet-Permissions: javax.microedition.io.Connector.socket,javax.microedition.io.Connector.file.write,javax.microedition.io.Connector.ssl,javax.microedition.io.Connector.file.read,javax.microedition.io.Connector.http,javax.microedition.io.Connector.https
    is it true?
    can anybody suggest me how can i solve this problem?
    where can I read full information about socket connection specifiecs in j2me?
    Thanks.

    Maybe this can be helpful:
    [http://download-llnw.oracle.com/javame/config/cldc/ref-impl/midp2.0/jsr118/index.html]
    you can check there the Datagram interface anda DatagramConnection interface and learn a little about that.
    If the client example runs fine in the wireless toolkit emulator, it should run the same way in your phone; i suggest to try to catch some exception that maybe is hapenning and display it on a Alert screen, this in the phone.

  • Using thread and socket connection with other machines

    Hi all!
    we are using weblgoic 5.1 SP9 JDK1.2.2
    we already using java.net.Socket and java.lang.Thread
    to communication TANDEM Machine on the weblogic.
    the reason why we use to socket and thread even though it is not
    recommanded is that below
    1. once we connect Socket, then we using until server shutdown or
    connection may has the problem, so we're using thread to wait
    java.io.Inputstream to read from socket.(if I using EJB, It can't
    wait socket inputstream indefinetly, because it has timeout)
    2. we're logging Database date sent or received with TANDEM Machine.
    so we need Database Access. so we using Database Access
    thru Weblogic.
    3. EJB Application using (other EJB Application - send Module)
    to send data to TANDEM Machine. So "Send Module" should
    be implemented EJB.
    but. Now I see there might be problem this framework.
    so, is there some way by just using J2EE spec, to implement this kind of
    framework.
    wait for your great help !!
    regards.

    Yes i've tried interrupt method and it doesn't have any effects on the thread... it stay in connect() method...
    And for the timeouts, in fact i use an API : J2SSH, to connect with SSH protocol, and the setting of connection timeouts is not implemented yet... and the default timeout is about 4 minutes...
    so i don't know how to solve this problem...

  • Oracle 9i LIte Connectivity with MIDP

    Hello,
    I am facing problem for connectivity of MIDP and Oracle 9i Lite. Anyone knows the which tool is good to desing the MIDP. Shall i use the Swing/AWT in MIDP. Is there any way to make Grid Layout and Buttons with MIDP.

    you cant user those in the MIDP
    but you have to call server application and then server applciation will fetch teh data from the oracle and retunr them back to midlet
    [email protected]

  • Multiple socket connection in TC65

    Hello!
    I connect TC65 with server by socket connection on port 23. I close this socket, output and input streams as well. Because I've read some information from server I want to connect to another device using socket connection on port 43 for example, but it seems it doesn't work. I guess in some way it could be done because I closed previous connection. Any advise?
    Luke

    ok. dear
    my another id is      [email protected]
    Right, I'm getting tired of this already.
    NO, I'm not going to send you any code, you lazy nitwit. Neither will anybody here.
    Your use of the imperative form in your question is rude. You may talk like that to your colleagues, but in a forum where people answer questions in their spare time and on a voluntary basis this is inacceptable.
    You didn't even bother to say "please", at the least. Not that this would have changed much, but at least you wouldn't have been barking.
    [url http://www.catb.org/~esr/faqs/smart-questions.html]This document might provide you some orientation.
    As for your problem, first find out what exactly it is you want to do. Search the web, as kajbj counselled, it's quite a common task. If you have a specific problem, ask. But, take my advice and never, never ever ask people to "send you code" in a forum.

  • Establish socket connection with local pc using Applet

    Hi,
    I want to write an applet embedded in my web application.
    When I access the web application from my PC which is connected to a RFID reader, I need the applet to make a socket connection to the attached RFID reader.
    Is this allow?
    If not, what do I need to make this possible for applet?
    Please advise.
    Thank you.

    HI Helen,
    Just to check.
    He is on XP ?
    He is using AIM 5.9 ?
    He has Tuned the camera and Mic to the App ?
    If he is at Service Pack 2 he has enabled the app through the XP firewall ?
    You have the MAc firewall Off.
    The ports are enabled in your modem.
    Either using UPnP or these actual ports
    5060, 5190, 5678, 16384-16403 for just the AIM stuff.
    Have you changed the Quicktime setting to match your download speed ?
    Can you and he get any of the people or test accounts o this page ?
    http://www.ralphjohnsuk.dsl.pipex.com/ContactTesters.html
    2:34 PM Saturday; April 8, 2006

  • Socket connection with remote PC

    Hi,
    I am trying to connect remote PC thru socket connection but to unable to setup.
    Can anyone give me sample code of how to do that.?both server n client code
    Thanks in advance.

    [http://java.sun.com/docs/books/tutorial/networking/index.html]

  • Multiple sockets connected to one port

    Hello I am running a LabVIEW VI that is based on the Labview TCPServer example. I am wondering what the best way to deal with multiple connections to a single port would be. For example I have a device(could be thought of as the same thing as the TCPClient vi) that connects to the server using the port number and the IP address. The communication works fine when there is only one device trying to connect to the server, the problem occurs when two devices try to connect to the server. When the first device connects all data sent shows up fine, when the second device connects, the status on the device indicates a proper connection but none of the data sent shows up on the server side. I assume that I must do something with the connection ID to distinguish between the two connections, but I was wondering if there was an example or something that deals with this issue, or if someone would like to explain how I could get the data to show up properly. Any help is appreciated, thanks!

    I am hoping that there is something similar to the java api where there is some way I can start a new threads to handle multiple connections on the same port. I would assume that if java has it LabVIEW would have something similar. Unfortunately I am not sure how to go about finding out how to do such a thing in LabVIEW.
    The way that I assume the TCPListen.vi works is that there is some mechanism polling the specified port and ip address waiting for a request for a connection. Once a request is received the VI creates a connection ID so that the other subvi's can perform operations on the specific connection. It also looks as though the TCPListen.vi continues to listen for new connections, because the clients indicate a connection when more then one of them are run trying to connect to the same port and IP.
    So my question is either, how to start a parallel process to handle the new connections, or where can I find the new connection ID (because the indicator only shows the connection id of the first client to connect). Basically I am having trouble distinguishing between the multiple connections on the same port.I would like to keep all of the clients sending data through the same port if possible.Each client identifies itself in its data message so keeping the data organized is not a problem. 
    I also looked at the data socket examples, mainly because the Java examples I was looking at used "Sockets". I ran into similar troubles finding a way to create distinguishable connections using DS's as well. Anyways, any help is appreciated. Thanks.

  • Multiple Socket Connections

    Hi,
    i need to simulate a http-POST by using a StreamConnection.
    This has to happen a lot of times, one post after the other.
    Server is closing the socket after each POST, so that i have to call a Connector.open(...) before each POST.
    The Problem now is, that the 3rd ED devices i use are showing the IAP-Dialog, asking for a new Connection to a IAP, although the old internet connection is still open.
    Is there any way to prevent this problem and make the client ask for Access Point connection only with the first Connector.open(..) call?
    Best Regards,
    Andi

    The domein is not changing, i wrote a small testcode to simulatre this problem.
    here you are:
    private StreamConnection streamConnection = null;
    private String connectString = "socket://www.someaddress.com:80";
    for( int i = 0; i<5; i++ )
    try
    streamConnection = (StreamConnection)Connector.open(connectString);
    catch( Exception e){}
    finally
    try{
    if(streamConnection != null)
    streamConnection.close();
    }catch(Exception ignore){}
    }This code is showing the question for internet access point five times.
    Problem is that we need the close of the socket, because of the servers architecture.
    Best Regards
    Andi

  • How to establish data socket connection with remote computer

    hi am new to data socket subject, cau u guys guide me on this...
    i want to establish connection between system with lv and datasocket modem.... so i need to create vi to receive
    the data and insert into sql from modem(its having data socket option).
     Pls help me.........

    duplicate post -- continue here

  • How to establish data socket connection with remote unit

    hi am new to data socket subject, cau u guys guide me on this...
    i want to establish connection between system with lv and datasocket modem.... so i need to create vi to receive
    the data and insert into sql from modem(its having data socket option).
     Pls help me.........

    duplicate post -- continue here

  • Security socket connection with the Applications Database Table

    Friends,
    As the security of connection when it is the integration of Oracle Identity Manager and a Oracle database through the database connector (Database Applications Table).
    With the following versions:
    - Oracle Identity Manager 9.1.0.2
    - Oracle WebLogic Server 10.3.5
    - Oracle Database 11.2.0.2
    - Oracle Solaris 10
    Thanks

    I have already posted on the Progress talk forum. Just wanted to know if anyone in this forum had the same problem if so i can get the solution.

  • Multiple input stream in one socket connection

    Can we have multiple input streams for a java socket connection? It means that in a client/server application (creates using java socket), can we have multiple input streams for the client side program. For example, the input streams are to cater for the need of letting the user to chat and downloading some files from the chat partner at the same time. And do we need to use thread to create the multiple input streams like the case when we create a multithreaded server? Anyone out there who knows the solution please post it. Thanks in advance.

    Can we have multiple input streams for a java socket
    connection? It means that in a client/server
    application (creates using java socket), can we have
    multiple input streams for the client side program.
    For example, the input streams are to cater for the
    need of letting the user to chat and downloading some
    files from the chat partner at the same time. And do
    we need to use thread to create the multiple input
    streams like the case when we create a multithreaded
    server? Anyone out there who knows the solution please
    post it. Thanks in advance.Ok im no expert here but this is what i learned:
    a Socket can have only one InputStream (Socket.getInputStream()) and one OutputStream Socket.getOutputStream()). So you will have to create a way to make multiple Socket connections in your client program. And yes, you have to use threads for your server. if you dont the client will have to wait until the user before them is finished with the connection before being able to connect. I hope this helps you out. BTW please check out http://www.javabible.com. they have the book online now for free.
    Joeyford1

  • Communication with database using TCP sockets connection

    Hi all,
    I am bit of a newbie when it comes to databases. In a project I realised over te passed few weeks, I communicated with an 11g database using an application I created with VS Express. It uses an ODBC connection. I now want to connect a PLC to the same database. These PLC's don't have the ability to install an ODBC client so I need something different.
    I am easily able to open a TCP socket on the PLC and send data from there. I would like to know if I can start a TCP sockets connection with our 11g server and send all queries directly. The other (already suggested) option would be to have the PLC connect to a PC that reads this information and hands it over to the ODBC connector, but that would mean I need an extra PC just to 'translate'.
    I have been searching these forums for socket, TCP and more and feel it is possible, but I need a good document as a reference to show/tell me how it's done.
    Thanks in advance,
    Marijn

    The TCP/IP interface to Oracle is undocumented (and hugely complex anyway). You'll need to use a higher layer iterface or setup your own infrastructure.
    We need more information about what is available to you inside the PLC.
    Can you use Java? If so, perhaps use thin JDBC?
    Can you sent HTTP requests? If so you could set up your own Web services to handle this.
    If you can only use C or C++, Oracle has interfaces there too.. it's called OCI (Oracle Call Interface) and thats as close to the networking layer as you can get.
    Finally if you can use .NET Oracle has a Fully Managed Oracle Data Provider for .NET that you could use.
    But if all you can do is super low level network access and none of the above then you will need to set up an intermediary as you mentioned.

  • How can i reuse my existing socket connection

    Hi,
    this might sound basic, it probably is:
    As part of my larger project, i have to send and recieve data to multiple socket connections.
    The thing that happens is that everytime i send data, it seems that java is creating a new stream or something (code is multithreaded)
    so as i send 4 items of data, a bit like a chat program sending 4 statements, it creates 4 different streams, instead of using the same stream. therefore when i close the connection, i get:
    java.net.SocketException: Connection reset 4 times.
    i know why.. its because i have added the:
    Socket socket=new Socket(host, port);
    BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    PrintWriter out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
    bit in the same method with the
    out.println(THE DATA....);
    out.flush();
    The thing what i want to do is to create the connection one, and reuse the objects:
    out, in and socket
    to send / recieve the new data.
    please help me guys,
    thanks

    All the threads would be able to get the same reference to....
    class SocketWrapper {
         private final Object readLock = new Object();
         private final Object writeLock = new Object();
         // client side
        public SocketWrapper(String hostname, int port);
         // server side.
        public SocketWrapper(Socket);
         // send data
         public void send(Serializable object) throws IOException;
         // receive data. synchronized(writeLock);
         public Serializable getNext() throws IOException;
         // create a new socket as required, throw IllegalState if server side. synchronized(readLock)
         private void createNewSocket() throws IllegalStateException;
    }The send autoconnects as required. It then send on message/packet/object.
    The getNext autoconnects as required. It reads one message/packet/object and returns.
    This allows multiple threads to access the same socket. It allows data to be sent while a thread is blocking on a read. (Thus two locks)

Maybe you are looking for