15,670,836 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View Python questions
View Javascript questions
View C++ questions
View Java questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 10657083 (Top 31 by date)
Member 10657083
22-Apr-16 4:07am
View
Thank you the error wasn't actually in the code but another header file.
Member 10657083
13-Mar-16 0:47am
View
How would you do that with the code above.
Member 10657083
11-Feb-16 4:48am
View
Ok I think I will proceed from that thank you.
Member 10657083
10-Feb-16 5:21am
View
Ok that just makes no sense,look at this.
https://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.progresschanged%28v=vs.110%29.aspx?cs-save-lang=1&cs-lang=cpp#code-snippet-2
Member 10657083
8-Feb-16 8:33am
View
Clearly that is wrong
auto textData = e->UserState->ToString();
error C2228: left of '.ToString' must have class/struct/union
From what I know this
backgroundWorker1->ReportProgress(0,data);
this meant to call the ProgressChanged function.
Member 10657083
7-Feb-16 6:02am
View
To go into more detail the progress report function does not do anything.
Member 10657083
6-Feb-16 23:02pm
View
The Full code
http://pastebin.com/P7EJFg5s
The code that causes the error and the error it's self
http://pastebin.com/PEBZVvy1
Member 10657083
6-Feb-16 3:59am
View
Deleted
The back ground worker doesn't like to make a progress report.
// Trigger for worker
if (!sysActive)
{
backgroundWorker1->RunWorkerAsync(1);
Sleep(1000);
sysActive = true;
cout << "Go" << endl;
}
else if (sysActive)
{
backgroundWorker1->CancelAsync();
Sleep(1000);
sysActive = false;
cout << "Stop" << endl;
}
// the do work thing
private: System::Void backgroundWorker1_DoWork_1(System::Object^ sender, System::ComponentModel::DoWorkEventArgs^ e)
{
while (sysActive)
{
if (backgroundWorker1->CancellationPending) //if it was cancelled
{
e->Cancel = true;
break;
}
if (!sysActive) //if the progress bar value reached maximum
{
break;
}
int data = runPing();
//backgroundWorker1->ReportProgress(0, Convert::ToString(data));
backgroundWorker1->ReportProgress(data); // the report does not work
Sleep(1000);
}
}
// should run with report
void backgroundWorker1_ProgressChanged(Object^ sender,ProgressChangedEventArgs^ e)
{
auto textData = safe_cast<int32>(e->UserState);
pingOutbox->Text = textData.ToString();
// Not necessary. The UI will update itself if the main thread is responding.
pingOutbox->Refresh();
cout << "MEEP" << endl;
}
Member 10657083
5-Feb-16 9:46am
View
error C2039: 'UserData': is not a member of 'System::ComponentModel::ProgressChangedEventArgs'
Member 10657083
4-Feb-16 6:18am
View
What does UserData refer to?
Member 10657083
20-Jan-16 7:39am
View
ok thanks
Member 10657083
20-Jan-16 4:20am
View
I will post the full code next time, also the program is meant to encrypt files. In order for that to happen quickly it requires the use of more than one thread.
It's a bit like having a tower made out of 8 blocks, you can move them all at once but that is slow. Instead you pull it apart and move it in 8 parts using 8 trucks.
Member 10657083
18-Jan-16 4:46am
View
In my first attempt it was which you can see above. Their is a losses of data the second their is corruption of data. That was made clear in the post above.
Member 10657083
18-Jan-16 3:10am
View
I would suggest testing it
Member 10657083
18-Jan-16 0:40am
View
I'll explain it once more how can a break a string into 8 parts and then put those 8 parts into a vector. I have tried to do this but it does not work, is that a good enough explanation.
Member 10657083
17-Jan-16 22:43pm
View
I will try to explain it again I am trying to store an entire string in 8 parts into a vector.
Let say you have 8 numbers like so
12345678
What I have tried to do is break the string into 8 parts no matter the size.
There could be even say 1000 characters my intention is for the program to adjust to assign data evenly to the vector.
So again you take your data
12345678
then
vector[0] = 1
vector[1] = 2
vector[2] = 3
vector[3] = 4
vector[4] = 5
vector[5] = 6
vector[6] = 7
vector[7] = 8
It is really that simple but making it work is not. That is why I am here how can I make this work I've tried doing so without any luck in the past.
Member 10657083
17-Jan-16 10:26am
View
The splitbreak function that is in the code is meant to do that. However it does not function to do so.
Member 10657083
4-Jan-16 10:10am
View
Oh wait
void runTest()
{
string data(12500000,'0');
for(int i = 0; i != 8; i++){ram[i] = data;}
key = "faaf";
mode = "E";
// Before it all
for(int i = 0; i != 8; i++)
{
writeDataToFile("before",ram[i]);
cout << "Before " << i << endl;
system("pause");
}
startCores();
// After encode
for(int i = 0; i != 8; i++)
{
writeDataToFile("after",ram[i]);
cout << "After " << i << endl;
system("pause");
}
mode = "D";
startCores();
// After decode
for(int i = 0; i != 8; i++)
{
writeDataToFile("end",ram[i]);
cout << "End " << i << endl;
system("pause");
}
cout << "All seems to be well";
}
This test proves you are wrong
Member 10657083
3-Jan-16 10:42am
View
So my code functions correctly in the sense it reads the file. However the strangeness of multi threading prevents it from working is that the case.
Member 10657083
3-Jan-16 10:07am
View
Then explain how the startCores function works to me because clearly I don't understand anything.
Member 10657083
3-Jan-16 6:22am
View
I ran a test and it runs fine multi threaded. The crypto++ side of it at least.
http://pastebin.com/wE3meSXs
I'll try rewiring the program to see if that helps, if anyone had ideas than post below.
Member 10657083
3-Jan-16 0:56am
View
The debuger did not provide any information. But it is worth noting that I compiled the program via command line. But I ran a little test and the result was rather interesting.
string data = "faaf networks is faaf";
string out;
stringAesCypher test;
test.encode(data,"1234",out);
test.decode(out,"1234",data);
out.resize(16);
test.decode(out,"1234",data);// the crash starts here
From this test the program will crash at the last decode function, should the ciphertext be bad. I don't know why it does this when with other ciphers it does not.
Member 10657083
2-Jan-16 22:47pm
View
I strongly believe that the problem lies within my code. The reason for this is because the encode and decode functions for AES are proven. Crypto++ is pretty solid and I have had no issues with it. However if you feed it bad cipher text it crashes the program. For that reason I have come to the conclusion that it is due to my code. However I am have yet to be able to pinpoint the issue with my code. Their are no compiler errors with my code, however the program does crash during decryption likely due to the bad cyphertext. I simply do not know where the issue lies in what I have written so far and that is why I am here. I do not know how to correct this problem.
Member 10657083
16-Dec-15 9:14am
View
The Answer was right in front of me thank you.
Full code for future reference should someone need it.
http://pastebin.com/r7Up00A3
Member 10657083
16-Dec-15 8:41am
View
Deleted
Ok so how would the accept function work to control the loop?
Member 10657083
16-Dec-15 5:28am
View
Ok but how would that look in with this snipet. How would you keep the client in this situation running and ready to receive data from the server.
int inDataLength=recv(Socket,data,1000,0);
cout << data << endl;
Member 10657083
26-Nov-15 8:56am
View
According the VS2015 debugger it's invalid cipher text. However it does decrypt during run time as long as you run the function while its encrypting. http://pastebin.com/5FLUXu5K
Member 10657083
22-Nov-15 8:18am
View
ok
Member 10657083
22-Nov-15 5:36am
View
I took your advice and it still crashes.
void encodeFile(string inputFileName,string outputFileName,string keyFileName)
{
ifstream fileStreamIn(inputFileName,ios::binary);
ofstream fileStreamOut(outputFileName,ios::binary);
size_t read_buffer(342);
char readBuffer[385];
string strBuf1(read_buffer,'\0');
string cypherBuf("");
// Sets the array
for(int i = 0; i != read_buffer + 1; i++)
{
readBuffer[i] = '\0';
}
while(fileStreamIn)
{
// Reads and gives sizes
fileStreamIn.read(readBuffer, read_buffer);
size_t count = fileStreamIn.gcount();
// Loads the array into the string
for(int i = 0; i != read_buffer; i++)
{
strBuf1[i] = readBuffer[i];
}
strBuf1.resize(count);// Changes for the actual size of the data
/**/
encode(strBuf1,cypherBuf,keyFileName);
/**/
//fileStreamOut.write(strBuf1.c_str(),strBuf1.length());
fileStreamOut.write(cypherBuf.c_str(),cypherBuf.length());
cypherBuf.resize(0);
if (!count)
break;
}
fileStreamIn.close();
fileStreamOut.close();
}
void decodeFile(string inputFileName,string outputFileName,string keyFileName)
{
ifstream fileStreamIn(inputFileName,ios::binary);
ofstream fileStreamOut(outputFileName,ios::binary);
size_t read_buffer(384);
char readBuffer[385];
string strBuf1(read_buffer,'\0');
string cypherBuf("");
// Sets the array
for(int i = 0; i != read_buffer + 1; i++)
{
readBuffer[i] = '\0';
}
while(fileStreamIn)
{
// Reads and gives sizes
fileStreamIn.read(readBuffer, read_buffer);
size_t count = fileStreamIn.gcount();
// Loads the array into the string
cypherBuf = "";
strBuf1 = "";
for(int i = 0; i != read_buffer; i++)
{
strBuf1[i] = readBuffer[i];
}
strBuf1.resize(count);// Changes for the actual size of the data
// encoder goes here
/**/
decode(strBuf1,cypherBuf,keyFileName);
/**/
//fileStreamOut.write(strBuf1.c_str(),strBuf1.length());
fileStreamOut.write(cypherBuf.c_str(),cypherBuf.length());
cypherBuf.resize(0);
if (!count)
break;
}
fileStreamIn.close();
fileStreamOut.close();
}
Member 10657083
21-Nov-15 9:01am
View
ok ty
Member 10657083
21-Nov-15 8:10am
View
I plan to rewrite the code using the char array as the buffer. But how would that look on the code above I am not sure how to implement that.
Show More