On the issue of the port already in use and multiply the application instance?

I use the message connection to receive sms. When I restart the application, I found the already used port exception. I've been through many posts and believe that BB allows a UNIQUE APPLICATION connecting the port of sms at a time. But the port of sms I know certainly is used only by my candidacy, is somehow wrong to create a second instance of application trying to access this port?

This question confused me a lot of time, to appreciate someone give me a help.

This problem has been resolved.

The two possible solutions for this problem:

1 re - save the connection string for registery push in the start method. but avoid registering a new when enforcement is woken up by sms push, otherwise it won't get the message.

public void startApp()
{
 String[] list = PushRegistry.listConnections( true );
            boolean isByPush = (list != null && list.length > 0) ? true : false;
            if(!isByPush)
            {
                PushRegistry.unregisterConnection( connString );
                PushRegistry.registerConnection( connString,Test.class.getName(), "*" );
            }

            bbReceiveSmsThread = new BBReceivingSmsThread(connString);
            bbReceiveSmsThread.start();        

}

    private static class BBReceivingSmsThread extends Thread
    {
        private boolean stop = false;
        private MessageConnection mc;
        private String connString;

        public BBReceivingSmsThread(String connString)
        {
            this.connString = connString;
        }

        public synchronized void stop() throws IOException
        {
            stop = true;
            mc.close(); // Close the connection so the thread returns.
        } 

        public void run()
        {
            try
            {
                mc = (MessageConnection)Connector.open(connString);
                for(;;)
                {
                    if ( stop ) return;

                    Message message = mc.receive();

                    String text = null;

                    if( message instanceof TextMessage ) text = ( (TextMessage)message ).getPayloadText();
                    if( message instanceof BinaryMessage ) text = new String( ( (BinaryMessage)message ).getPayloadData(), "UTF-8" );

                    if(text != null)
                    {
                       //do your message here
                    }
               }
          }
          catch (Exception e) {}
        }
    }

Tags: BlackBerry Developers

Similar Questions

  • SMS port already in use... MessageConnection using connector.open

    I created an application that listens for incoming txt messages and it works very well on all devices except the 8330... works of ideal app on all phones on sms listening but on the 8330 I get the problem where the exception says "port already in use"... my application is currently in beta and a user reported he was continues smart guard... as soon as he took the chip guard the app works perfectly... so im guessing as smart guard uses sms messages to intitate itself is what is the origin of the port problem... is there anyway around this? my code is below...

    public void open()
        {
            this.controller.write("Attempting to open message connection (Message tracker)");
            try {
                this.msgconnection=(MessageConnection)Connector.open("sms://:0");
            } catch (IOException e) {
                this.controller.writeToConsole("Error opening message Connection (MessageTracker) "+e.getMessage());
            }
            try {
                if(this.msgconnection!=null)
                {
                this.msgconnection.setMessageListener(this);
                }
            } catch (Exception e) {
                this.controller.writeToConsole("Error adding messagelistner (MessageTracker) "+e.getMessage());
            }
        }
    

    MessageConnection is pretty useless, since only one application can attach to the SMS port at a time.

    My advice is to switch to use the method of datagram.

    See this article:

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

  • This product key for Vista Ultimate is for 2 users; the computer tells me that it is already in use, and it is the second computer. Then I don't understand what the problem is.

    product activation key

    This product key for Vista Ultimate is for 2 users; the computer tells me that it is already in use, and it is the second computer. Then I don't understand what the problem is.

    There is no such thing as a ' 2 License User"for Windows.

    It * may * be for 2 processors. These 2 processors MUST be on the same physical motherboard.

    You use WIndows out-of-contract of license and will have to purchase a new license to the second machine.

  • On the MIcrosoft Web site, when I put my product key, they say that this license is already in use, and I have to ask the manufacturer of PC

    Original title: WINDOWS license

    Hello everyone.

    Ive broke my PAvilion G6 core i5 laptop and now I'm going to change the internal hard drive. How can I use my old license of Windows 7. On the MIcrosoft Web site, when I put my product key, they say this license is already in use and I must ask the manufactor PC.

    I thank in advance for which will help me!

    Hello

    Or you can also borrow the same exact retail edition DVD of Windows 7 and use your product key to reinstall.

    The COA sticker with the product key is either or in the battery compartment on the underside of the laptop.

    With a desktop computer, it's on the side, the back or the top of the computer case.

    If you have problems with Activation:

    If it does require phone activation, do not follow Demand of Auto, but brace yourself for a real person explain as to what has been done for purposes of re-setup

    "How to activate Windows 7 by phone '

    http://www.SevenForums.com/tutorials/18715-activate-Windows-7-phone.html

    The above method also requires that you go to your computer manufacturer's website > Support and downloads Section > locate your model number and operating system > then download and install the latest drivers for it.

    See you soon.

  • net.rim.device.api.io.IOPortAlreadyBoundException: SMS port already in use.

    It's strange, the code works fine on j2me, but it does not work on Blackberry. I'm testing with Blackberry 9000 V4.6 emulator. He throws net.rim.device.api.io.IOPortAlreadyBoundException: SMS port already in use. when I try to open a connection.

    The line below throws the exception:

    MC MessageConnection = (MessageConnection) Connector.open (connection);

    It seems that the port is already open, but I don't know that I finally closed the connection by exiting the application.

    The link below gives me a great help:

    http://supportforums.BlackBerry.com/T5/Java-development/SMS-MessageConnection/m-p/63975#M7177

  • Port already in use exception...

    Hello

    Being a beginner in blackberry I have some problems while developing Java applications for blackberry. I am developing CLDC application that receives SMS on perticular port in a background thread. But when I sent sms to my application using this perticular port, I got "Port already in use exception." What could be the problem. ?

    Code shown below...

    Builder includes:

    try {}
    incomingConnection = (DatagramConnection)Connector.open("sms://:7878");
               
    } catch (Exception e) {}
    Dialog.Alert ("problem with port" + e);

    Thread contains:

    While (true) {}
    try {}
    Datagram sms = incomingConnection.newDatagram (incomingConnection.getMaximumLength ());
    incomingConnection.receive (sms);
    payload of Byte [] = sms.getData ();
    } catch (Exception e) {}

    }

    Thank you

    Pritesh

    Hi pritesh_bb,

    Well understood, the error itself would mean that another application has already got hold of this port, and as explained it is first come first served. As such, you will be able to return to the port, unless you uninstall the other application. Would it be possible for you to change the port number? Perhaps 9189 or similar?

    Concerning

  • create the missing icon against the section of the form of the application instance

    Hi all

    I use OIM 11 g R2 PS2, and I see that create icon missing against the section of the form of the application instance. I am trying to create an instance of the application, and when I try to load the form, I don't see the icon 'create' at all.

    Is this a known problem. ?

    Thanks in advance.

    This changed in OIM 11 g R2 PS2 version. To create resources for the instance of the application, you must follow the steps below:

    1. connect the console to sysadmin

    2. create a sandbox

    3. go in Configuration--> Form Designer--> select the resource type--> click on the button create

    From there, you can create the form. Once the form is created, it will be visible in the Instance, application from which you can modify the same.

    HTH

  • FPGA Interface C API, error-63105, OR-RIO: C/C++ identifier is already in use and cannot be created.

    Hello

    Installation program:

    1 x the NI PCIe-7841R

    When I am trying to automatically generate a C++ API for my top FPGA VI using the FPGA Interface C API 12.0 I get the following error.

    Error-63105

    NOR-RIO:

    The "NiFpga_FPGATop_IndicatorBool_DMAFIFOtimeoutoccured" C/C++ identifier is already in use and cannot be created.

    Anyone know what this means? Is there some kind of limitation on the appellation of front interface controls?

    /Mola

    Problem solved.

    I had placed two flags with the same name on the front panel - by mistake. It builds the FPGA without errors, but the C API generator was not in favour of that.

    / Mola

  • When installing sync tells me my e-mail address is already in use and won't let me go any further. I just got an email and do not want to install another. How can I configure sync?

    I can log in account synchronization with this URL https://account.services.mozilla.com management and is listed. When I go to the tab sync in the Preferences window, only two options are listed: set up a new account and or to pair a device. Setting up an account, I cannot use the e-mail address that I'd like to, saying that the email is already in use. I can not "associate a device" because the computer I'm trying to 'pair' is my main computer (laptop). I used sync mode at the time when it first came out and it seems as if there are new requirements (legal and other) forces me to set up a new account. How to set up and use the synchronization with the email address, I have already in place without having to use another email address?

    There was a major change in synchronization services back in December 2010, but nothing w9th regard to the username / email address and password for this time.

    This will reset your synchronization password if you don't remember, an existing account.

    https://services.Mozilla.com/reset-password/

    What ever you have stored on the server will be deleted if you will start with new data in the system.

  • DataFile has added unfairly, but already in use and data in

    Hi Oracle partisan comrades.

    Please excuse my ignorance, I'm still learn a lot, and thanks to you all will continue to learn, so thank you very much in advance.

    My question/problem, I added accidentally a data file to one of our storage spaces this data file is already used and filled with data.
    Now, I need to delete the data file and then add it correctly with the right name etc (I added that he named but it something else then standard one big no, no society) so how better would copy the data in the data file to the new data file and drop the old a?
    And all of this (if possible) must be done LIVE we cannot afford any downtime because this specific database is used in a hospital setting.

    All tips are more then welcome thank you very much in advance

    (BTW: this is a database of oracle 11g no instance a single RAC if information is needed please ask and I will gladly.)

    Captain spock disconnection :)

    The best thing would simply be moving the data file. It would be more cost-effective. It generates even a downtime for the database.

    If you want to delete a data file and re-create it, you would have to reorganize the entire tablespace, a much more complicated case, and it would generate a lot more downtime for the tablespace.

    Basically, you'd have to:

    1 export your data from the tablespace set.
    2. create a new table space.
    3. remove the old tablespace.
    4. import your data into the new tablespace.

    Or you can:

    1. create the new tablespace.
    2. move all the objects in the old tablespace with TRAVEL orders.
    3. remove the old tablespace.

    What method is best depends on the volume of data. The first method using datapump is much more reliable for large volumes of data.

  • Whenever I click on the Firefox icon a sign says it's already to use and to clean, I have need to re-boot, after re-booting the same message is displayed each time

    I can't get into Mozilla as the Panel appears every time it's running

    Must be the problem of "cling to the exit.

    1. Stop the Firefox process:

    2. Why Firefox may crash:
    3. Firefox Safe mode allows to find a problem with an Extension or a Plugin:

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

  • Close the SMS port if it is already in use.

    Hello

    I try to open the port by SMS

    MessageConnection messageConnection = (MessageConnection) Connector.open (connection_name);

    It throws an IOException saying "cannot open: SMS Port already in use.

    Is it possible to close this connection?

    Thanks in advance

    Concerning

    Coralie.

    No, if you did not create yourself.
    You should check for that, although every time I met this error I used port myself (still active instance or not properly closed port)

  • I want to create the user in the direct areas but I found thi message: the requested account name is already in use.

    Over the period of re - use the account in the domains.live

    I want to create the user in the direct areas but I found thi message

    The requested account name is already in use or has been used in the past and has not been through the waiting period required of re - use.

    Can you help me

    Hi, Ahmed.

    It seems that the domain name you have selected is not available (or has already been used and it is found that the previous owner of the domain has used the same user name as an account).  In any case we can not help you here.  You need help from domain.live.

    Please go to http://help.live.com/help.aspx?project=domains&market=en-us&querytype=keyword&query=SNIAMODTUOBA&tmt=&domain=domains.live.com&format=b1 and down, click on support and follow the prompts to get help.  Although it is technically to the implementation of the field, I'm sure that your application will be either still answered or they will direct you to the proper location for assistance.

    In addition, you can try http://windowslivehelp.com/product.aspx?productid=25 for help Windows Live Administration.  If you can not find help with solutions validated or by performing a search, try posting in the forums.  I suggest the following for the problem that you specified: http://windowslivehelp.com/forums.aspx?forumid=7e6f04c0-6a48-4719-98f4-a9729d34c76e.

    I hope this helps.

    Good luck!

  • prevent the 2 instances of process model

    Hello

    We have several testers in operation.  There is a particular test that we run, which has some downtime involved on the object to be measured, and it seems that there is no test running.  Then a person can come and try to run another instance of a sequence, so re - run model of process, trying to initialize the hardware that is already in use and causing a cascade of errors, screwing as the test that was running.

    Is there a property, I can verify from the outset in the process template, I can program into a command prompt to warn the person "there is already another ongoing test here, an abortion?" and "cleanly"?  Or better yet, is there an option somewhere in teststand as "to prevent simultaneous execution of process model" or such?

    Thank you

    David Jenkinson

    Try this one.

  • Get the name of the Instance of the Application in an IOM PrePopulationAdapter

    We have at disposal of the IOM to multiple Active Directory domains. To do this, we installed a connector AD, Multiple Instances of the Application of several Instances of IT resources, while using one and the same resource object and form. Self-service console we want to request an account (Instance of the Application) to a user, and we can choose AD1, AD2, and AD3. When we choose, lets say, AD3 do we want to pre-fill the field organization name (OU in AD) with a specific organizational unit in Active Directory corresponding to the Application Instance AD3. The problem is that in the PrepopulationAdapter we have not managed to identify the instance of the application of demand.

    Here's how to get the instance of the application of demand in an adapter to prepopulate:

    prepopulate (RequestData requestData) serializable public get {RequestServiceException}
    String response = "";
    RequestBeneficiaryEntity targetEntity = requestData.getBeneficiaries () .get (0) .getTargetEntities () .get (0);
    EntityType of OIMType = targetEntity.getRequestEntityType ();
    If (entityType! = OIMType.ApplicationInstance)
    Return ' ';

    try {}
    String entitySubType = targetEntity.getEntitySubType ();
    ApplicationInstance appInst is getAppService () .findApplicationInstanceByName (entitySubType);.

    .... Continue your own code

    getAppService is the ApplicationInstanceService API.

    -Kevin

Maybe you are looking for