Results 1 to 7 of 7

Thread: Qt as Client and Java as a Server. It's that possible ?

  1. #1
    Join Date
    May 2009
    Posts
    3
    Thanks
    2
    Qt products
    Qt4 Qt Jambi
    Platforms
    Unix/X11

    Question Qt as Client and Java as a Server. It's that possible ?

    Hi to all and thats my first post …and I got a few doubts

    I receive a project at school that consist on a little application “Client&Sever” so here a short description ..

    Server Side: “Must be platform independent , able to switch over a few DBs without much of trouble and OO ”
    sooo been a Java Web dev for 2 years my logical choice was “Java and Hibernate” that will do the job just fine fast and clean..

    Cliente Side: “Light ,Fast and platform independent” and cannot be a “ webapp”

    Here's my problem starts , I hate SWT/swing , it's not light not that fast and definally not pretty(my opinion) and on top off all this I actually never did a full GUI application.

    Been a Linux/KDE user as well I know that Qt4 really rocks for GUI apps but a have no clue if it's possible to integrate those two technologies , How they will communicate and so on..
    And I know about QT Jambi and because it's a dead end it's out , I can only use technologies well supported ..

    If my post seems silly, I'm sorry I never did anything on QT/C++ before, but I will , in a near future.

    Any suggestion I will appreciate

    Tks

    sry about my bad English..

  2. #2
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt as Client and Java as a Server. It's that possible ?

    Its possbile. You can write the server in the language of your choice and the client in the language of your choice as long as the speak the same protocol.

    For example we have a very simple Qt-App that waits on a updsocket and waits for plain textstrings. The "client" is a bashscript using netcat to send strings in the format. Very simple and works.

    The command on the client side is:
    Qt Code:
    1. netcat -u localhost 1234 "progressbar : 30"
    To copy to clipboard, switch view to plain text mode 

    And the server (in Qt) has something like this:

    Qt Code:
    1. while (_udp_socket->hasPendingDatagrams()) {
    2. QByteArray datagram;
    3. datagram.resize(_udp_socket->pendingDatagramSize());
    4.  
    5. QHostAddress sender;
    6. quint16 senderPort;
    7.  
    8. _udp_socket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
    9.  
    10. processTheDatagram(datagram);
    11. }
    12.  
    13. void ProgressWindow::processTheDatagram(const QByteArray& datagram) {
    14. QString data = QString(datagram).trimmed();
    15.  
    16. if(stringRepresentsAProgessUpdate(data)) {
    17. //do something
    18. }
    19.  
    20. }
    To copy to clipboard, switch view to plain text mode 

    An of couse in more complex scenarios you can also use a well known protocoll with cool features, but that depends on what you are doing.

    But without C++ Experience this could be very difficult, because C++ is not so easy to handle and comfortable as Java (in my opinion)
    Last edited by nightghost; 26th May 2009 at 18:10.

  3. The following user says thank you to nightghost for this useful post:

    eroskoller (26th May 2009)

  4. #3
    Join Date
    May 2009
    Posts
    3
    Thanks
    2
    Qt products
    Qt4 Qt Jambi
    Platforms
    Unix/X11

    Default Re: Qt as Client and Java as a Server. It's that possible ?

    thank you very much for the fast reply nightghost


    i'll check this out it seems my way to go..

    if u guys have any other references links (ideas) pls post i have to collect a lot information i still have to convict not only myself but my collegues (most are Delphi devs so even Java sounds uncomfortable for them)


    but i can say i'm already happy ..

  5. #4
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt as Client and Java as a Server. It's that possible ?

    Perhaps http://doc.trolltech.com/4.5/examples.html will help you for network programming with Qt. There are a few Networkexamples if you scroll down.

  6. The following user says thank you to nightghost for this useful post:

    eroskoller (26th May 2009)

  7. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt as Client and Java as a Server. It's that possible ?

    What is the server supposed to do? Maybe you could implement it with Qt as well?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #6
    Join Date
    May 2009
    Posts
    3
    Thanks
    2
    Qt products
    Qt4 Qt Jambi
    Platforms
    Unix/X11

    Default Re: Qt as Client and Java as a Server. It's that possible ?

    The server it's not supposed to do much ("persistence ,update retrieve User,Costumer info etc") the key thing is it must be cross-platform and i must be able to switch DBs (MySQL,Firebird and Postgres) .

  9. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt as Client and Java as a Server. It's that possible ?

    Quote Originally Posted by eroskoller View Post
    The server it's not supposed to do much ("persistence ,update retrieve User,Costumer info etc") the key thing is it must be cross-platform and i must be able to switch DBs (MySQL,Firebird and Postgres) .
    Which makes Qt an event better candidate for its implementation...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Sending string from QT client to Java server
    By seanmu13 in forum Qt Programming
    Replies: 10
    Last Post: 3rd July 2007, 13:52
  2. Sending string from QT client to Java server
    By seanmu13 in forum Newbie
    Replies: 3
    Last Post: 3rd July 2007, 13:20

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.