Results 1 to 5 of 5

Thread: Multiple TcpClients to multiple Servers

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Multiple TcpClients to multiple Servers

    TcpClient::ReadTcpData(), Connected(), Disconnected() and ErrHandler() are declared as signals not slots: you do not provide implementations for signals because they are generated by moc. I think you intend these to be slots based on earlier attempts to connect to them as slots.

  2. #2
    Join Date
    Jun 2012
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiple TcpClients to multiple Servers

    You're absolutely right. Thanks so much for taking the time to look at it.

    I have another question if you don't mind. In the TcpClient class readyRead() signal is there a way of sending the client socket connection that received/generated the readyRead() to the slot that receives the signal? In other words I would like to have a common slot routine which not only reads the receiving message but knows which server connection it received the data on for communicating back to that server. As I have it now each TcpClient connection has its own slot routine and from this I was planning on emitting/relaying the client connection and data to the subscriber. Is what I'm doing the best way of accomplishing what I want?

    Also if I continue with my current approach, I would like to connect, I guess effectively signals from each TcpClient object to a slot in MainWindow. Does this have to be relayed or re-emitted through ConnectionMgr or is there a more efficient way to connect directly to emits from the TcpClient to slots in the MainWindow.

    Thanks again for your time.
    Last edited by sa5webber; 20th June 2012 at 19:03.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Multiple TcpClients to multiple Servers

    There is no TcpClient::readyRead() signal declared that I can see. Assuming you mean readyRead() emitted by TcpClient::_tcpClient then you can connect it to a slot in TcpClient that simply emits a signal, defined on TcpClient, that carries the TcpClient address to any listeners. Passing the QTcpSocket's address would allow external access to the private member variable: possibly not a good idea..

  4. #4
    Join Date
    Jun 2012
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiple TcpClients to multiple Servers

    Yes the readyRead() signal is not defined in TcpClient.h segment here. When I entered this listing I was still trying to resolve the errors I had asked about with this listing which as you pointed out was due to me still getting my head around the signal/slot naming convention. That mistake has definitely made that clearer to me.

    In any event I have what I was asking about working with the ConnectionMgr receiving and re-emitting each of the TcpClient signals to the MainWindow. So in this case I might have actually answered my own question. Again I can't tell you how much I appreciate and admire all of the help people like you provide to this forum. I'm sure I'll have other questions as I forage my way through QT. Thanks for being there.

Similar Threads

  1. using one signal to update multiple multiple controls
    By henryjoye in forum Qt Programming
    Replies: 7
    Last Post: 13th December 2011, 14:19
  2. Replies: 2
    Last Post: 19th October 2011, 09:30
  3. Replies: 1
    Last Post: 17th May 2011, 16:12
  4. Multiple use of QGraphicScene
    By Xtresis in forum Newbie
    Replies: 4
    Last Post: 6th September 2010, 12:06
  5. Replies: 0
    Last Post: 21st December 2006, 11:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.