-
-
Notifications
You must be signed in to change notification settings - Fork 99
Open
Labels
bugSomething isn't workingSomething isn't working
Description
When client.write()
finally sends I get the following error. [RangeError: Property storage exceeds 196607 properties]
. I'm then trying to send that data via your library. Do you see any issues here? I don't have control over the server, it's expecting a binary file not chunks of a binary file, so I don't thinking chunking is even an option here.
const startImageTransfer = (connInfo) => {
console.log("––––––– startImageTransfer() ––––––––");
if (connInfo && imageData) {
// console.log("Starting image transfer with connInfo:", connInfo);
const header = JSON.stringify({
num: 0,
total: 1,
fileLength: imageData.length,
fileName: "something",
fileType: "jpg",
secKey: connInfo.key,
version: "0.0.1",
});
const options = {
port: parseInt(connInfo.port),
host: connInfo.ip,
reuseAddress: true,
};
const client = TcpSocket.createConnection(options, async () => {
console.log("––––––– TCP connected! ––––––––");
try {
// Send header length (4 bytes)
const headerBytes = Buffer.from(header, "utf8");
const headerLength = Buffer.alloc(4);
headerLength.writeUInt32BE(headerBytes.length);
const combinedData = Buffer.concat([
headerLength,
headerBytes,
imageData,
]);
client.write(combinedData);
console.log("Sent combined data:", combinedData);
client.end();
} catch (error) {
console.error("Error sending data:", error);
}
});
client.on("data", (data) => {
console.log("TCP received:", data.toString());
});
client.on("error", (error) => {
console.error("TCP Error:", error);
});
client.on("close", () => {
console.log("TCP Connection closed");
});
} else {
console.error("Missing connInfo or imageData");
}
};
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working