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

  • Home
  • SEARCH
  • 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 8004635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:58:21+00:00 2026-06-04T16:58:21+00:00

Qt 4.8, Windows XP: I have a thread that manages my TCP messages and

  • 0

Qt 4.8, Windows XP:

I have a thread that manages my TCP messages and opens / maintains / closes the socket at the appropriate times.

This same thread starts a QTimer, 200 ms, defined in my thread’s data, that pumps an event in my thread’s class once (if) the socket is open. So the timer and its event belong to the thread, as best I understand the idea.

The QTimer timeout event sends a TCP message through the port belonging to the thread, it’s a keep-alive message for this particular hardware item. Has to be sent regularly or the device “goes away” which won’t do.

When the message is sent, I get this error:

“QSocketNotifier: socket notifiers cannot be enabled from another thread”

As far as I can tell, I am sending the message from the same thread and would expect any signals, etc., to be owned / handled etc. by it.

Can anyone tell me what I’m missing here?

PS: The message is sent, the device does stay alive… it’s just that I’m getting this runtime error on the Qt error console and I’m very concerned that there are internal problems lurking because of it.

The message does NOT occur running under OS X 10.6. I don’t know why.

  • 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-04T16:58:23+00:00Added an answer on June 4, 2026 at 4:58 pm

    Ok, here’s the scoop. QTimer, for reason only known to the designers of QT, inherits the context of the parent of the thread. Not the context of the thread it’s launched from. So when the timer goes off, and you send a message from the slot it called, you’re not in the thread’s context, you’re in the parents context.

    You also can’t launch a thread that is child of THAT thread, so that you can fire a timer that will actually be in the thread you want. Qt won’t let it run.

    So, spend some memory, make a queue, load the message into the queue from elsewhere, watch the queue in the thread that owns the TCP port, and send em when ya got em. That works.

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

Sidebar

Related Questions

I have a windows form on the main thread and another thread that does
I have a Windows service that processes jobs. A job in this service is
I have a Windows Forms app that itself launches different threads to do different
I am getting this error on code that used to work. I have not
I have single-thread windows form application written with VB.NET and targeting Framework 1.1 .
I have a windows service that fails to start under some circumstances. When it
I have a security manager in my application that works for both windows and
I have a windows service written in C# that creates a truck load of
I have an app with a UITabBarController that manages some UINavigationControllers, which in turn
I have a program that I run and in the middle I get this

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.