Listen to incoming messages of chat server

Hi all

I am trying to connect to a chat server and send messages to a known user id. I am able to connect to the server and you connect and send a message to a user. But I am confused about how to listen to incoming messages.

Here is the code that I am trying... This code below is written in the run method of a class that extends the Thread.

final StreamConnection connection = (StreamConnection) Connector
 .open("socket://" + this.server + ":" + this.port,Connector.READ_WRITE);
DataOutputStream o = connection.openDataOutputStream();
DataInputStream i = connection.openDataInputStream();
this.writer = new XmlWriter(o);
if(!isLogin){
 this.login();
}
this.sendMessage();
int c;
while (true) {
    c = i.read();
    if (c == -1) {
    break;
    } else {
    System.out.println(String.valueOf(((char) c)));
    }

I try it in the Simulator 8330.  Initially the output xml confirming authentication is printed, but after that, I get the exception.

net.rim.device.cldc.io.ippp.SocketBaseIOException: Connection Timed Out

Please can someone help me understand what's wrong. I want to establish a connection, so that the Instant Messaging would be possible between the two users.

Thanks in advance,

BAJ

Solved using the below the project open-source:

http://sourceforge.NET/projects/kvmjab/

Tags: BlackBerry Developers

Similar Questions

  • listen to the message of BlackBerry incoming/outgoing

    Hello.
    I am new to BlackBerry.

    Try to catch the incoming and outgoing BlackBerry messages.

    Have a problem. Code does not work on Tour 9630.

    Import net.rim.device.api.ui.UiApplication;
    Import net.rim.blackberry.api.phone.Phone;
    import net.rim.device.api.system.ControlledAccessExceptio n;
    Import net.rim.device.api.ui.component.Dialog;
    Import net.rim.blackberry.api.phone.phonelogs.PhoneLogs;

    final class MainClass extends UiApplication
    {
    Public Shared Sub main (String [] args)
    {
    If (args! = null & args.length > 0 & args [0] .equals ("autostartup"))
    {
    *****
    Application of MainClass = new MainClass();
    application.enterEventDispatcher ();
    }
    on the other
    {
    }
    }
        
    public MainClass()
    {
    new BBMessagerLog();
    }
    }

    import net.rim.blackberry.api.blackberrymessenger.Session

    Listening port;
    Import net.rim.blackberry.api.blackberrymessenger.Message;
    Import net.rim.blackberry.api.blackberrymessenger.Session;

    / public class BBMessagerLog implements SessionListener
    {
    BBMessagerLog()
    {
           
    }
        
    Indicates that an outgoing Message arrived at its destination
    ' Public Sub messageDelivered (a session Message message) {}
    }
        
    Indicates that a Message has been queued for sending a Session
    ' Public Sub messageQueuedForSend (a session Message message) {}
    }
        
    Indicates that an incoming Message was received by a Session
    ' Public Sub messageReceived (a session, the message)
    {
    Send data to the server
    }
        
    Indicates that an outgoing Message has been sent
    ' Public Sub messageSent (a session, the message)
    {
    Send data to the server
            
    }
        
    Indicates that a Session was closed
    {} public void sessionClosed (one session)
    }
    }

    JCarty wrote:

    Let me add that the demo of morpion is obsolete now that the API for BBM have been left out and they rewrite you for more recent versions of BBM surveys.

    I wouldn't bother with currently documented APIs.

    https://www.BlackBerry.com/jira/browse/JAVAAPI-1231

    good to know, thanks for the update JCarty!

  • How to receive as net.rim.blackberry.api.mail.Message When listening for incoming sms?

    There are 3 types of ways to listen for incoming sms in the following link:

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

    All those who receive the javax.wireless.messaging.Message for further processing.

    I need to check the priority of the message received, which is only available in net.rim.blackberry.api.mail.Message and not javax.wireless.messaging.Message.

    Can someone guide me to get the net.rim.blackberry.api.mail.Message When listening for incoming sms?

    Thank you.

    Net.rim.blackberry.api.mail.Message is actually for mails not for sms

    Press the button Bravo thank the user who has helped you.

    If your problem has been resolved then please mark the thread as "accepted Solution".

  • How to create a Websocket Java client application that receives incoming Messages

    Hello

    How to create a Java only incoming Websocket application receives Messages?

    For example, here's a Html 5 Websocket:

    http://html5demos.com/Web-socket  That runs on that server for Node.js: ws://node.remysharp.com:8001

    Now I want a Java client side? How can I achieve this?

    Moreover, my main go is for users to post messages of the web and goto the smartphone blackberry with this application.

    Looking forward to your helpful answers

    Hamid Weiss

    It is quite easy to create a socket to listen:
    "socket: / /: 79 sets a socket server incoming on port 79.
    See http://www.blackberry.com/developers/docs/7.1.0api/javax/microedition/io/ServerSocketConnection.html

    However, you should be aware that a mobile device is not directly accessible (except wireless) because they do not receive a public ip address on a wireless (keyword NAT).

    to resolve this issue it is support to push.
    See http://docs.blackberry.com/en/developers/subcategories/?userType=21&category=Push+Service
    (the link below goes to the 7.1 API for java bb).

    If you are new to development, you should think about the new platform bb10 so when you expand.

  • Is it possible to delete a single message on the server that maintains download repeatedly in my Inbox?

    For some reason any and that periodically, the same message is constantly in my Inbox. It's frustrating because it must block the other download messages. I know that I can put in place a "delete server messages" framework with a scale of appropriate time, but it will delete all incoming messages. I just want to be able to stop the offending continually message download once again after that I removed from my inbox - this can happen up to 30 times for the same message!

    Sign in to your account via webmail and delete the message that is causing the problem.

  • messages are deleted from the server, even if I "Leave messages on the server" selected.

    I use Thunderbird 24.4.0 to download my mail via the POP3 service. My messages are deleted on the server when I erase it in Thunderbird. I have Thunderbird set to "leave the message on the server" and I checked "until I have delete ' it worked for several years with no problems. something has changed in the last week or two that I can't understand. Can you help me.
    Thank you
    Jerry Laufer

     Application Basics
    
       Name: Thunderbird
       Version: 24.4.0
       User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
       Profile Folder: Show Folder
    
                 (Local drive)
       Application Build ID: 20140316131045
       Enabled Plugins: about:plugins
       Build Configuration: about:buildconfig
       Crash Reports: about:crashes
       Memory Use: about:memory
    
     Mail and News Accounts
       account1:
         INCOMING: account1, , (none) Local Folders, plain, passwordCleartext
    
       account2:
         INCOMING: account2, , (pop3) pop3.postoffice.net:110, plain, passwordCleartext
         OUTGOING: smtp.postoffice.net:2525, plain, passwordCleartext, true
    
       account3:
         INCOMING: account3, , (pop3) transparentvideo.net:110, plain, passwordCleartext
         OUTGOING: smtp.postoffice.net:2525, plain, passwordCleartext, true
    
       account11:
         INCOMING: account11, , (pop3) pop.cox.net:110, plain, passwordCleartext
         OUTGOING: smtp.postoffice.net:2525, plain, passwordCleartext, true
    
       account12:
         INCOMING: account12, , (pop3) pop.cox.net:110, plain, passwordCleartext
         OUTGOING: smtp.postoffice.net:2525, plain, passwordCleartext, true
    
     Extensions
       Forward, 0.18, true, [email protected]
    

    I think the problem might be the option "when I delete them. That tells Thunderbird to reach out and the cops messages on the server when you delete them in Thunderbird. Instead, check the box to leave messages on the server and clear the check boxes under that.

  • How can I turn off automatic transfer of all incoming messages?

    All incoming messages are sent to a gmail account. I would like to disable this feature. I've tried from Thunderbird without Add-ons, and it has not solved the problem.

    It's probably something install you to your account on the server. It has nothing to do with Thunderbird.

  • On OSx 10.11.4 but incoming messages can no longer send

    Hello

    I tried this search for a few weeks now, but I am at my whits end. I used to use Messages religiously on my Mac Mini at the office (worked flawlessly). Mini Mac running OS X 10.11.4 El Capitan and the iPhone (iOS 9.3.1). 6Plus My iMessage is related to this computer for reference text as well as my iMac at home (where it still works perfectly), which makes me realize that this is a problem with this particular computer.

    Initially, my computer did not show the authorization code after withdrawing from the transmission of text, then finally she showed. I'm registered, but the contacts that I can iMessage from my iPhone / iPad, appear in green and the message fails to be sent with the message error'[email protected] is not registered with iMessage." However, if they text me, their message appears in the Messages on the computer (aka the synchronization works), but 99.9% of the time my answer to contact fails. Occasionally, one of my answers might send if they text me first. If I close the application however and try their message, it fails with the above error message. By clicking on the coordinates, I can see that they have iMessage, but the app will default to the SMS mode green and do not use the iMessage contacts account. My contacts work fine in the Mail application as well.

    In the Messages preferences, I am connected with the same Apple ID as my phone and iMac at home. I tried signing in and out of Apple ID again, in and out of iMessage on the phone, reset the transmission of text, reset the NVRAM. Zapped all the files associated with the Messages, but the problem persists. OSX will not let me "transplant" another app Messages, because it is an application required by OSX and I don't know how to get around the permissions. When I check "on my Mac", the serial number is visible.

    I have not yet tried to contact the Apple Support to reset my Apple ID iMessages (ID: AppleID-Auth Token) in the hope that I don't have to spend a lot of time on the phone.

    This was very frustrating, because I have many of my clients (and friends) contact directly through iMessage and SMS, and the app was surprisingly easy to communicate to me from my computer.

    Any help and suggestions would be GREATLY appreciated.

    Thanks...

    Mike

    Hello

    If...

    You get the not registered for each contact

    And

    The serial number is present.

    And the app looks like it is connected but doesn't get sync iMessages copies (it may be difficult without turning off the options for knowledge if you see addressed to iPhone number iMessages or the Apple ID or if in fact they are SMS messages as all incoming messages are gray balloons).

    IF on top of that it does not work in another mac user but works with another Apple ID

    So the question is at the server end.

    22:10 Sunday. May 1, 2016

     iMac 2.5 Ghz i5 2011 (El Capitan)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro (Snow Leopard 10.6.8) 2 GB
     Mac OS X (10.6.8).
     iPhone and iPad (2)

  • Problem with new incoming messages to my Windows Mail account

    Since 2-3 weeks, I've known more fault with new messages from my Inbox on Windows Mail.  I have the 1st message, but then the connection is interrupted and I get the following message: "your server has ended suddenly the connection. The possible causes for this include server problems, network problems, or a long period of inactivity. Account: 'pop.tiscali.co.uk', server: 'pop.tiscali.co.uk', Protocol: POP3, Port: 110, secure (SSL): no, error number: 0x800CCC0F. "Error may occur when I log in to access new messages from the server, or when the mail comes while I was already connected.  The fault is intermittent: sometimes I can access mail normally again.  When I live the flaw, I close the Windows Mail error message, press the send/receive button and my incoming emails (including the 1st) is normally followed.  For the record, I'm not problems with outgoing mail.

    I would appreciate any ideas on what could be causing this fault and what remedial measures I could take.

    Charles

    You are welcome.
     
    See if that helps.
     
    I have no first hand know how to do this in Norton that I would never use Norton. Very common with any security program which is mail scanning has never caused a problem, but there is an update and 'poof', there you go.
     
    Why you don't need your anti-virus to scan your email
    http://thundercloud.NET/infoave/tutorials/email-scanning/index.htm
     
  • I can send emails but CAN NOT receive messages through POP3 server... 0x800CCC0F error messge

    My POP3 incoming messages don't come out whenever I get the following message:
    "Your server has terminated suddenly the connection. The possible causes for this include server problems, network problems, or a long period of inactivity. Account: * e-mail address is removed from the privacy *', server: 'pop.bizmail.yahoo.com', Protocol: POP3, Port: 995, secure (SSL): Yes, error number: 0x800CCC0F. »
    I disabled the analysis of incoming messages on my Norton anti-virus, but I don't always get mail.
    Help please!

    See also www.oehelp.com/OETips.aspx#3 Norton and Windows Mail will not agree, and you'd be better off with a much less invasive anti-virus as www.microsoft.com/security_essentials/ program, which is also free.

    In any case, start by checking your account works via webmail access.  If it works, then try to remove your e-mail account in Winmail opener and then compact and repair the database (www.oehelp.com/WMUtil/).  Then add your account to mail back again and see if that fixes the problem.

    Steve

  • New icon for the application of new incoming message after...

    Hi guys! I did the application that receives electronic messages. How can I change the icon of the application on the incoming message to my icon 'unread '? My application is started automatically when the device is turned on. And second entry point to start my application manually (with GUI). Auto-start, fixed it successfully icon and icon Overview:

    HomeScreen.updateIcon (icon, 0);

    HomeScreen.setRolloverIcon (icon2, 0);

    but on the message inbound (FolderListener.messagesAdded start), these functions generate an exception:

    I tried change index 1,2,3... BU result is the same... Where is my problem? Maybe there is another way to change the icon at this time? Help, please. Thanks in advance.

    Do not forget that in the file listener, you actually in the mail app not running your application.  You need get this change is made in your application.  The best way to proceed is to use GlobalEvents, that fire in your listener and deal with it in your Application to change the icon.

    See below for more details:

    What is - world events and global event listeners
    Article number: DB-00145
     
    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/796557/800332/800620/...

  • With the help of legends custom B2B with incoming messages batch to push directly to an AQ queue

    I'm trying to create a legend, attached to a partnership agreement, which will process an incoming batch load and write each individual message in the batch to advanced queue.

    I have the following in place pieces and works so far... 

    1 QA 

    2 B2B lot

    3. partnership agreements

    4 making SOA message waiting

    5 Basic legend in place and access to the message.

    My problem occurs in step 5.  My legend is fired as each message in the batch is traversed and the output of the whole lot (all messages) seem to be added to the AQ at the same time. (They are messages separate, which is good, but I try to insert a pause in order to limit the speed at which these messages are pushed on the queue).

    My question is, How can I publish the message I shot of the lot to QA immediately that I did it - as opposed to add the message to the standard output of the legend? 

    [sample code and further explanation below]

    . . .

    I have tried this approach because my queue is set up in a clustered environment and the options I've seen so far for the AQ limitation apply only to single-server systems.  For example, setting the property minimumDelayBetweenMessages in my composite SOA side for fact the message isn't an option for me.  We have no access to the database settings associated with querying on distributed systems.

     

    Here is a version of my legend:

    public class inboundThrottler implements legend

     

    public Sub run (context of CalloutContext, )

    throws CalloutDomainException, CalloutSystemException  

    { 

       try  

    //Retrieve the properties of the legend of CalloutContext

    String context.getStringProperty = TimeInterval ("timeIntervalInSeconds"); 

      System. on .println ("Time-out interval is" + timeInterval); 

    //Get the message of the legend of entry

    //Message Passthrough

    CalloutMessage cmOut = cmIn;

                try {

      TimeUnit. SECONDS . Sleep (timeIntervalAsLong);

    { } catch (InterruptedException e) { }

                          System. on .println ('error found in the part of the timeout of the legend');

    e.printStackTrace ();

                      }

      System. on .println ("+++ B2B LEGEND PROPERLY TREATED +++ ');

    output.add (cmOut);

    //Throw exception, if any

      { } catch (Exception e) { }

                     System. on .println ('error found in the legend'); 

    take new (e) CalloutDomainException;

      }

      }

      }

     

    Y at - it something other than output.add (cmOut); can I use to insert my message in QA?

    In my server logs, I can see the "+++ B2B LEGEND CORRECTLY PROCESSED +++ ' message for each message in the batch however, they are all pushed to the AQ at the same time and that is why they are all handled by the composite made as fast it can handle to Dequeue the message.  When we deal with more payloads of 5000 messages, the end result is a highly bogged down the server and in some extreme cases, the server crash.

       

    Thank you in advance for any input. Even if there are better ways to strangle my incoming messages (I certainly heard about these opportunities) for my own edification, I too wish to know suggestions for the insertion of my message in AQ at the point in my code that I have highlighted.

    I found a solution, and because I didn't know all the answers on this topic, I'll go ahead and answer myself for the sake of posterity.

    The short answer is do not use a legend Java at all since the intention of the legend was first place to strangle incoming messages so that they are placed on QA in a more controlled way and at a pace slower to allow SOA handle a large load. I found an excellent article, "handling large payloads" [https://docs.oracle.com/middleware/1213/b2b/b2b-user/app_perform.htm] which addressed my needs perfectly.

    To summarize in a few words, there are a number of settings that can be made as size to commit partial lot, size of the payload and large load useful program, in conjunction with a setting called 'Enable the Streaming' in the bpel AQ adapter side SOA Dequeue of things who will accomplish what I need to do.  The version I use is Oracle SOA Suite 11.1.1.7

    Directly related to the question, I referred to above concerning how to insert a message directly in my QA:

    I will not go into the horrific details, but basically I create a ConnectionFactory via an InteractionSpec to get the right connection managed, then convert the message correctly and insert the message in the queue, taking care to manage the space of thread, and close all open connections.  Finally, in my contract partner, I make a note to NOT add the message to the queue after my process of legend in order to avoid duplication of messages.

    All said, I'm happy I found a way to let SOA Suite and B2B to treat this issue with a few "out of the box" settings, because even if the captions can be very useful to insert a custom header or do a quick transformation, using them to enter the bowels of my managed connections are not a walk in the Park.

    Hope this question and the subsequent response will be useful to those seeking similar tasks on the road.

  • TBird does not delete messages from POP3 server with setting of ' leave messages on the server until I delete them.

    I use the pop3 Storage account. I installed thunderbird to download messages only when I ask them. I installed thunderbird to leave messages on the server until I delete them. I am able to send and receive messages without problem, but the messages that I delete the Inbox of Tbird not deleted from the server.

    In addition, what is the expected behavior for messages on the server if I move them to a local folder? That should remove them from the server, or they remain on the server until I have remove the local folder?

    Thank you.

    Deleting a message that "it mark as deleted", but it's still in the folder that is hidden from view. It's now displaying in the folder "deleted".

    you need to compact your file.
    ClickON Inbox right and select "Compact".

    Inbox, junk and probably get most of the activity when it comes to deletion, so they should be compacted ona regularly.
    I have several emails that I will delete every day, so these two fodler get compacted by day.

    See info on:
    maintain a healthy thunderbird.

    Compacting file, what it does and why it is important.

    Info Backup:

  • Why Thunderbird leaving messages on my server even though I have an IMAP account?

    I did some research online and tried all the solutions. Some descriptions say that IMAP accounts always leave messages on the server because they have to, and others which contradict. I am really confused and frustrated. I just want to know what I have to do to open my messages on my computer, delete them if I want, but know that they are always on my Comcast server, if I want to access it later.

    The part you are missing is that the IMAP protocol is based on the e-mail server. You simply display messages remotely on your computer or other devices. If you delete an email you're disconnected from the server. This is why there is no option to leave Message on the server as it is in a pop account. The messages are ONLY on the server until you do something different with them as move a copy to local folders.
    If you want to keep a copy of this message to your local device, you must first move a copy of the message in a folder under local folders.
    When you are sure that the message is in this local folder and you can access it, then you can remove safely from the server.

  • Thunderbird deletes the messages from the server if I said not to do so.

    I use a POP3 server and have 'leave messages on the server - until I delete"checked but Thunderbird is still deleting messages from the server before my other e-mail viewer gets it.

    If my other program (from MR2ICE under OS2 on another machine) Gets the first messages, I'll see them on both machines.

    If Thunderbird 'em first I don't get them on the other machine, and, when I check via webmail, they aren't there.

    Thank you.

    If you want to see messages on several machines, POP is not the best choice. You choose to use POP, or is it you imposed by the e-mail provider?

    I don't have a job here POP account to check with, but you can try with the option ' until I have delete ' unchecked? You doing anything with messages, such as moving them to another folder?

    I've never been confident with the way that ' until I have remove the ' works; If a message has been moved out of the Inbox to another folder, and you remove it, a request to delete the message always spread on the server?

    With IMAP, by moving a message to a folder in account to somewhere the IMAP server can not see it is actually a deletion; the server can no longer see the message, so syncs by removing its own copy of this message. I haven't checked through what a POP server is in similar circumstances.

Maybe you are looking for