PDA

View Full Version : Qt4 Windows Networking



bothapn
25th January 2007, 13:21
Hi everyone,

I need to copy files from a windows machine to a network server. Both run windows and the qt application is run on the client machine which needs to copy the files over to the server.

This thing puzzles me because QNetwork have specific ftp and http code, but nothing more. This leads me to the conclusion that I will probably need to implement the smb protocol in some way.. which is totally wrong.

Any ideas maybe?

Tx

wysota
25th January 2007, 13:27
Maybe simply:
a) transfer files over http protocol (one side of the communication is already done)
or
b) simply transfer files using sockets

You don't need to implement any special protocol to do that. If you only need the actual data (meaning no need for filename, dates, etc.) then just send the data through socket and accept it on the other size. You may want to send the size of the file as the first word of communication to know if you already received the whole transmission.

jacek
25th January 2007, 13:27
Can't you just map server's share on the client? This way you can copy files just as if it was a local disk.

bothapn
25th January 2007, 13:35
The idea is that there is no interaction from the user. No mapping of network drives thus.
Also, this client does not run on the server so I need to use windows samba networking like in: \\server\share

wysota
25th January 2007, 13:46
So maybe it'd be easier to use the native Samba interface? Does your application need to be portable?

bothapn
25th January 2007, 14:41
The application wont be used on linux. only windows xp and 2000 so partability is not that much of an issue

jacek
25th January 2007, 17:31
The idea is that there is no interaction from the user. No mapping of network drives thus.
Also, this client does not run on the server so I need to use windows samba networking like in: \\server\share
Have you tried this?
QFile f( "\\\\server\\share\\file.txt" );
f.open( QIODevice::WriteOnly | QIODevice::Text );
QTextStream( &f ) << "aaa";