int main(int argc, char **argv) {
	listenSocket = socket(AF_INET,SOCK_STREAM,0);

	KeyGen(&public, &private); 
	strcpy(IP, argv[1]);
	
	char * buf; 
	buf = strdup(argv[2]);

	char filename[50];
	char chat_msg[50];

	
	char * returncode;
	
	bzero(filename, 50);
	filename[0] = 'k';		// Send Public Key
	filename[1] = '\0';

	sprintf(filename+1, "%lld:", public.public_key.e);
	sprintf(filename+strlen(filename), "%lld\0", public.public_key.n);
	printf("Key generated: %s\n", filename);
	sendMsg(filename, 0); 
	bzero(filename, 50);
	cpy(filename+1, buf);
	filename[0] = 'd';		// Get File

	initDownload(filename);
	return 0;
}
예제 #2
0
void Updater::getUrl(QNetworkReply *reply)
{
    if (reply->error() == QNetworkReply::NoError)
    {
        QString url = toRealURL(reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toString());
        initDownload(url);
    }
    else if (reply->error() == QNetworkReply::TimeoutError)
    {
        ui->statusLabel->setText(tr("ERROR: Connection timed out..."));
        ui->startButton->setEnabled(true);
    }
    else
    {
        ui->statusLabel->setText(tr("An error occurred. Please check your internet connection."));
        ui->startButton->setEnabled(true);
    }
}