Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8015769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:20:46+00:00 2026-06-04T20:20:46+00:00

I experience a quite strange behavior using smack to build a small XMPP Client/Bot.

  • 0

I experience a quite strange behavior using smack to build a small XMPP Client/Bot. I set up the connection as well as a ConnectionListener and a ChatManagerListener. This works quite fine and I can then chat with my application which is running on a portable device.

To test behavior on lost connection I plugged out the ethernet cable of the portable device. I expected the XMPP client to lose the connection and that the user will be set ‘offline’ in the roster of the users buddies. What happens is, that this user is still shown as ‘online’ and ConnectionListener of my client fires nothing, whether connectionClosed nor reconnectionFailed or else.

When I then plug the ethernet cable back in, sometimes it’s like the connection has been alive all the time. The offline messages are handled and I can chat again like before.
Other times my client is totally inaccessible and out of order, seems like all the listeners are gone… But no excpetions are thrown.

That’s a quite strange and uncontrollable behavior that would make the whole client unusable for me, as I can’t be sure that the client will come up again after connection has been arborted.

Has anybody else experienced such problems or has any hints what’s (not) happening?

If needed I can provide my code, but it’s actually just copy & paste from the Smack documentation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:20:48+00:00Added an answer on June 4, 2026 at 8:20 pm

    You are actually describing two different effects here. Let’s start with the one that’s named in the title of your question: The user is assumed online by the server even if the connection is abruptly, and therefore unclean, aborted. The reason is simply that the server hasn’t noticed the disconnect of the client yet, as there was no clean termination of the XMPP stanza stream. Most XMPP server check the clients with an ping every X minutes. If a client does not respond it’s assumed disconnected and shown offline (if it was the last connected resource for that JID). That hasn’t happened here and is not uncommon. Because sometimes you want to have long timeouts (half an hour or longer).

    The same applies to the other side. Smack also sends XMPP pings every X minutes if PingManager or PingManagerWithAlarmManager (for Android) is used. If there is any problem with the used socket, an exception is thrown.

    I hope that I could point you into the right direction. You have to debug for yourself why the connection is not terminated with an exception in your case.

    One last thing: An TCP connection can easily survive some timeout even if the Ethernet cable is plugged out and then back in. There are many timeouts on various layers of the OSI model involved: NAT, TCP, XMPP, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just recently bumped into a strange behavior of JSoup library 1.3.3 (quite old,
I am currently develope something using asp.net MVC, im still quite not experience with
I have my own threading library built using TinyThread++. It works quite well, and
I have quite a bit of experience using the basic comm and group MPI2
I have quite some experience with php, but I am very new to using
I experience the following problem while using legacy VC6. I just cann't switch to
I experience strange problem. We have error handling in global.asax that would redirect user
I have a little experience developing small command-line applications with Python. I want to
I experience quite annoying side-effect of class/structure padding with Purify . E.g. struct something
Alright, so I'm new to Android programming, so far my experience has been quite

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.