git-svn-id: svn://db.shs.com.ru/pip@71 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2015-04-07 10:53:26 +00:00
parent edd3d5f354
commit ac88ca0e7f
2 changed files with 23 additions and 13 deletions

View File

@@ -12,7 +12,8 @@ public:
quet_ = false;
eth.setReadAddress(src_ip_port);
eth.setSendAddress(dst_ip_port);
//ft.setPacketSize(65000);
ft.setPacketSize(8192);
ft.setName("PIFT");
CONNECTU(&ft, sendRequest, this, ftsend);
CONNECTU(&ft, sendFilesStarted, this, ftevent);
CONNECTU(&ft, receiveFilesStarted, this, ftevent);
@@ -39,6 +40,10 @@ private:
void tick(void *, int) {
if (ft.isSending() || ft.isReceiving()) {
ftevent();
if (PIKbdListener::exiting) {
ft.stopSend();
ft.stopReceive();
}
// piCout << (int)ft.diagnostic().quality();
}
}
@@ -71,8 +76,9 @@ private:
void usage() {
piCout << Bold << "PIP UDP file transfer";
piCout << Cyan << "Version" << Bold << PIPVersion() << NewLine;
piCout << Green << Bold << "Usage:" << Default << "\"pift [-hq] -r <receive_ip> -s <send_ip> [-d <work_dir>] [-p port] [<path1>] [<path2>] [<path3>] [...]\"" << NewLine;
piCout << Green << Bold << "Usage:" << Default << "\"pift [-hqf] -r <receive_ip> -s <send_ip> [-d <work_dir>] [-p port] [<path1>] [<path2>] [<path3>] [...]\"" << NewLine;
piCout << Green << Bold << "Details:";
piCout << "-f " << Green << "- full path in <receive_ip> and <send_ip>";
piCout << "-h " << Green << "- display this message and exit";
piCout << "-q " << Green << "- quiet, no debug output to console";
piCout << "-r " << Green << "- set receive ip address, must be ip address of this computer";
@@ -92,7 +98,8 @@ int main (int argc, char * argv[]) {
cli.addArgument("port", true);
cli.addArgument("help");
cli.addArgument("quet");
if (!cli.hasArgument("send") || !cli.hasArgument("receive") || cli.hasArgument("help")) {
cli.addArgument("fullpath");
if ((!cli.hasArgument("send") || !cli.hasArgument("receive")) || cli.hasArgument("help")) {
usage();
return 0;
}
@@ -101,10 +108,12 @@ int main (int argc, char * argv[]) {
int port = -1;
if (cli.hasArgument("port")) port = cli.argumentValue("port").toInt();
if (port <=0) port = 50005;
if (!cli.hasArgument("fullpath")) {
src += ":"+PIString::fromNumber(port);
dst += ":"+PIString::fromNumber(port);
}
PIKbdListener kbd;
kbd.enableExitCapture();
src += ":"+PIString::fromNumber(port);
dst += ":"+PIString::fromNumber(port);
UDPFileTransfer f(src, dst);
if (cli.hasArgument("dir")) f.ft.setDirectory(cli.argumentValue("dir"));
if (cli.hasArgument("quet")) f.setQuet(true);