상단

Electron


  • Electron

    • Electron 24.3.1

      • Node 18.14.0

      • Chromium 112.0.5615.183

    • Electron Forge 6.1.1

    • Electron Fiddle

  • Documents

  • API

 

Networks


 

Net

  • net : HTTP, HTTPS

 
const { app } = require('electron');

app.whenReady().then(() => {
  const { net } = require('electron');
  const request = net.request('https://github.com');
    
  request.on('response', (response) => {
    console.log(`STATUS: ${response.statusCode}`);
    console.log(`HEADERS: ${JSON.stringify(response.headers)}`);
      
    response.on('data', (chunk) => {
      console.log(`BODY: ${chunk}`);
    });
      
    response.on('end', () => {
      console.log('No more data in response.');
    });
  })
  request.end();
});

 

const net = require('net');
const client = new net.Socket();

client.connect(8080, '127.0.0.1', function() {
    client.write('Hello');
});

client.on('data', function(data) {
    console.log(data);
    client.destroy();
});

client.on('close', function() {
    console.log('Bye');
});
 

SerialPort

 

최종 수정일: 2024-09-30 12:26:19

이전글 :
다음글 :