2021-05-14 11:36:15 +00:00
|
|
|
<html>
|
|
|
|
<body>
|
|
|
|
<iframe id="mainframe"></iframe>
|
|
|
|
<script>
|
2023-06-15 14:42:27 +00:00
|
|
|
const net = require('node:net');
|
|
|
|
const path = require('node:path');
|
2021-05-14 11:36:15 +00:00
|
|
|
|
|
|
|
document.getElementById("mainframe").src="./page2.html";
|
|
|
|
|
|
|
|
const p = process.platform === 'win32'
|
|
|
|
? path.join('\\\\?\\pipe', process.cwd(), 'myctl')
|
|
|
|
: '/tmp/echo.sock';
|
|
|
|
|
|
|
|
const client = net.createConnection({ path: p }, () => {
|
|
|
|
console.log('connected to server');
|
|
|
|
client.write('world!\r\n');
|
|
|
|
});
|
|
|
|
|
|
|
|
client.on('data', (data) => {
|
|
|
|
console.log(data.toString());
|
|
|
|
client.end();
|
|
|
|
});
|
|
|
|
|
|
|
|
client.on('end', () => {
|
|
|
|
console.log('disconnected from server');
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|