Results 1 to 7 of 7

Thread: Execute method on server application.

  1. #1
    Join Date
    Jun 2009
    Location
    Krakow, Poland
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Execute method on server application.

    Hello.
    I have been looking on Qt example: fortuneserver. FortuneServer is responding on incomingConnection event and returning randome QString. How to define my own public methos on server application? For example I would like to allow client application to call server method:
    Qt Code:
    1. public QString GetCustomerLastName(const int& customerID);
    2. public void SetCustomerLastName(const int& customerID, const QString& lastName);
    To copy to clipboard, switch view to plain text mode 
    Howto define those kind public methods on server and how to call them from client application?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Execute method on server application.

    This is off topic for this forum.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jun 2009
    Location
    Krakow, Poland
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Execute method on server application.

    Com on I'm fresh with Qt and this tipic is about Qt client-server application.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Execute method on server application.

    No, its about basic C++.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    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: Execute method on server application.

    You need to:
    1. Receive the incoming request, which may not be from a Qt client.
    2. Interpret the request, validate provided parameters, check permissions etc.
    3. Call the relevant method(s) in the server code to service the request.
    4. Send the result back to the client.


    You are asking about steps 2 and 3. You can do these any way you like. Step 2 might be disassembling a SOAP, XML-RPC or some other request packet. Step 3 involves some sort of mapping mechanism. There is no magic expose-this-method-on-the-net language extension in C++.

  6. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Execute method on server application.

    There is no magic expose-this-method-on-the-net
    So that's what he was after.... ah...
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  7. #7
    Join Date
    Jun 2009
    Location
    Krakow, Poland
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Execute method on server application.

    I have read about gSOAP. I would like to use gSOAP in my Qt project. Base on FortuneServer example I have created server application that for any connected client is creating separated thread and keeping connection (and thread) alive until client get disconnected.
    In gSOAP documentation I found how to Generate C++ Server Object Classes files.
    Question: Is it enough if I will create gSOAP (*.h and *.cpp) files from header file that is containing all public server methods and attach generated files into my server and client application?

Similar Threads

  1. Replies: 0
    Last Post: 28th February 2011, 09:10
  2. How to upload file to HTTP server (POST Method)
    By Alex Snet in forum Qt Programming
    Replies: 8
    Last Post: 24th January 2011, 22:49
  3. Replies: 2
    Last Post: 24th March 2010, 10:31
  4. Replies: 5
    Last Post: 4th March 2010, 19:31
  5. How to execute an exe file from Qt application
    By maveric in forum Qt Programming
    Replies: 1
    Last Post: 24th May 2008, 10:24

Tags for this Thread

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.