C++ でネイティブ ホストを使用しています。サイズが base64 < 1M の base64 をネイティブ アプリから Chrome 拡張機能 (ネイティブ メッセージング) に送信すると、プログラムはまだ実行されています。しかし、サイズが1Mを超えるbase64をネイティブアプリからchrome拡張機能(ネイティブメッセージング)に送信すると、プログラムはエラー「ネイティブメッセージングホストとの通信中にエラーが発生しました」という私のコード
int _tmain(int argc, _TCHAR* argv[])
{
std::cout.setf( std::ios_base::unitbuf );
unsigned int c, t=0;
inp="";
t=0;
// Sum the first 4 chars from stdin (the length of the message passed).
for (int i = 0; i <= 3; i++) {
//t += getchar();
t += std::pow(256.0f, i) * getchar();
}
// Loop getchar to pull in the message until we reach the total
// length provided.
for (int i=0; i < t; i++) {
c = getchar();
inp += c;
}
unsigned int len = inp.length();
// We need to send the 4 btyes of length information
std::cout << char(((len>>0) & 0xFF))
<< char(((len>>8) & 0xFF))
<< char(((len>>16) & 0xFF))
<< char(((len>>24) & 0xFF));
// Now we can output our message
std::cout << inp;
return 0;
}