Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
Forum Updated to NodeBB v4.3 + New Features

QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread

Scheduled Pinned Locked Moved Unsolved General and Desktop
qthreadqtcpserver
23 Posts 3 Posters 6.6k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • CP71C CP71

    @Dooham
    Hi,
    I quickly watch your code.
    I see a thing that is a bit dangerous or I think so, you emit a pointer and not a copy of data without thread synchronization, don’t you?

    DoohamD Offline
    DoohamD Offline
    Dooham
    wrote on last edited by
    #21

    @CP71 I dont know if this is dangerous or not, but it is easy to change, I think. So I will change it later to pass a QByteArray and not a QByteArray pointer. Related to pendingConnection, I don know if this is necessary or not. I am just going to have a few connection. I proved ths code with three clients and I didnt have troubles. With the exception that I cant send message to the serialport, but is a problem that dont depend of the number of connections. However I saw that the trouble is that the socket dont emit the signal readyRead in the socket of the server when I receive a message from a client.

    CP71C 1 Reply Last reply
    1
    • DoohamD Dooham

      @CP71 I dont know if this is dangerous or not, but it is easy to change, I think. So I will change it later to pass a QByteArray and not a QByteArray pointer. Related to pendingConnection, I don know if this is necessary or not. I am just going to have a few connection. I proved ths code with three clients and I didnt have troubles. With the exception that I cant send message to the serialport, but is a problem that dont depend of the number of connections. However I saw that the trouble is that the socket dont emit the signal readyRead in the socket of the server when I receive a message from a client.

      CP71C Offline
      CP71C Offline
      CP71
      wrote on last edited by
      #22

      @Dooham
      Ok,
      When we have some problems we say, “the computer has always reason”, well almost always.
      I’m joking ;)

      I already done a TCP Server but I took another road and I hadn't got special problems, so now I haven’t ideas. :(

      If I can, I suggest you to solve one problem at a time, I would start at the end, as per QtcpSocket, to try to understand why readyRead seems not working I should check the following checks:

      • Check with Wireshark or other tools if TCP packets arrive to your device
      • Check by debug text info about QTcpSocket that you have created (e.g. IP of the client)

      Then climb up to TcpServer.

      Sorry

      DoohamD 1 Reply Last reply
      1
      • CP71C CP71

        @Dooham
        Ok,
        When we have some problems we say, “the computer has always reason”, well almost always.
        I’m joking ;)

        I already done a TCP Server but I took another road and I hadn't got special problems, so now I haven’t ideas. :(

        If I can, I suggest you to solve one problem at a time, I would start at the end, as per QtcpSocket, to try to understand why readyRead seems not working I should check the following checks:

        • Check with Wireshark or other tools if TCP packets arrive to your device
        • Check by debug text info about QTcpSocket that you have created (e.g. IP of the client)

        Then climb up to TcpServer.

        Sorry

        DoohamD Offline
        DoohamD Offline
        Dooham
        wrote on last edited by
        #23

        @CP71 Dont worry, you are helpful. I will tried to find the trouble, I know that must be in my Code of the server, because in the first Code that I published in this thread I could do It. And in a simpler Code for just one connection server-client It also worked.

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved