Results 1 to 1 of 1

Thread: QTcpServer

  1. #1
    Join Date
    Sep 2011
    Posts
    45
    Thanks
    17
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QTcpServer

    Hello!

    I would like to create a server- And here is the problem: server will accept some messages and for certain message server suppose to do some certain work. If I'll use if ... else statements it will look like a "macaroni" code: long and useless. Is any other way, not if ... else? For instance, creating for each command its own class and building during runtime, when command was received from client, using reflection(.Net mechanism)?

    Thank you for your answers beforehand.


    Added after 1 27 minutes:


    I got it=) Next time I need to read documentation more carefully. So the solution is:
    - Create the class;
    - Put there methods with Q_INVOKABLE;
    - Use QMetaObject::invokeMethod(...) //for more information read documentation

    But here is another question: How much it will slow down the program?


    And looking on that method: QObject * newInstance ( QGenericArgument val0 = QGenericArgument( 0 ), QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(), QGenericArgument val3 = QGenericArgument(), QGenericArgument val4 = QGenericArgument(), QGenericArgument val5 = QGenericArgument(), QGenericArgument val6 = QGenericArgument(), QGenericArgument val7 = QGenericArgument(), QGenericArgument val8 = QGenericArgument(), QGenericArgument val9 = QGenericArgument() ) const

    I guess we can't create the instance of the class by name. Am I right?
    Last edited by DmitryNik; 25th October 2011 at 12:59.

Similar Threads

  1. QTcpServer
    By DmitryNik in forum Newbie
    Replies: 2
    Last Post: 1st October 2011, 08:07
  2. QTcpServer Problem
    By ionutdanila in forum Newbie
    Replies: 2
    Last Post: 27th December 2010, 12:18
  3. QTcpServer and GDB
    By baray98 in forum Qt Programming
    Replies: 2
    Last Post: 21st January 2009, 08:02
  4. QTcpServer + Authorization
    By NoRulez in forum Qt Programming
    Replies: 2
    Last Post: 27th May 2008, 14:04
  5. Replies: 1
    Last Post: 18th June 2006, 10:12

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.