How to form a client/server setup using Qt?



  • i have connected two PC's using LAN (both are running on RHEL OS). How does one transfer data , access files, run them etc in the other PC from a particular PC "using Qt" ???



  • What do you mean by "access files, run them"?
    You need to create both client and server apps (or use ssh as server one) and implement all needed functionality there. QTcpSocket (or QUdpSocket) will help you.



  • I'm not sure, if this is what you want.. but to transfer data, you need to run a Qt application on both pc's, one acting as the server, other as the client. Then you could use Qt's TCP classes maybe to make a connection to the ip, port and transfer data. You could also have a dual connection, each is both server and client, depending on your need. If you need to transfer a lot of data, you could use the QFtp class. But you need to be running the ftp server on the host (but that's trivial in Linux anyway). And why do you want to use Qt to transfer files? Automation? Backups?



  • @ Denis - wat i meant was ... i need to access the PC remotely and be able to run .exe files on that PC remotely !

    Which function used to define IP address in Qt?


  • Moderators

    you may use "this ":http://doc.qt.nokia.com/4.7/qhostaddress.html to define an IP address in Qt.
    Here you find the details "QtTcpServer":http://doc.qt.nokia.com/4.7/qtcpserver.html



  • So, what you need to to implement a server and client, define your protocol, and make the calls needed. Suppose, you want to run myexe.exe on the remote machine, you would send an XML request maybe like <request_run executable="myexe.exe"/>. Which would then be parsed on the remote machine by your application and can run the executable. Now, you can then send some response back too in a similar fashion. If you want to get the visual output of the execution like Remote Desktop... thats not gonna be easy. Anyways, read about RPC (Remote Procedure Call) and the Qt classes QTcpServer and QTcpSocket.



  • Why do you want to use Qt for that? To me, it sounds like you need a ready-made solution.



  • @ Andre ..My final product should be that i should
    "click a button" on say PC1 which should run a executable on PC2 in a LAN !

    Now how do i do that ?



  • Create an application on PC2 which listens on some TCP socket. It receives "commands" from PC1 and reacts on those. It's up to you to invent a suitable protocol.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.