MCPcopy Create free account
hub / github.com/deepclause/agentvm / writeToNetwork

Method writeToNetwork

src/network.js:260–274  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

258 // Called when VM writes data to the network interface (FD 3)
259 // We need to unwrap QEMU framing (4-byte len) -> Frame
260 writeToNetwork(data) {
261 this.rxBuffer = Buffer.concat([this.rxBuffer, data]);
262
263 while (this.rxBuffer.length >= 4) {
264 const frameLen = this.rxBuffer.readUInt32BE(0);
265 if (this.rxBuffer.length < 4 + frameLen) {
266 break; // Wait for more data
267 }
268
269 const frame = this.rxBuffer.subarray(4, 4 + frameLen);
270 this.receive(frame); // Process the frame
271
272 this.rxBuffer = this.rxBuffer.subarray(4 + frameLen);
273 }
274 }
275
276 // Called when VM wants to read data from the network interface
277 readFromNetwork(maxLen) {

Callers 2

stack.test.jsFile · 0.80
startFunction · 0.80

Calls 1

receiveMethod · 0.95

Tested by

no test coverage detected