퍼포먼스 측정

bi_sz·2020년 5월 15일
0

과제

목록 보기
3/6

1. HTTP 서버 만들기

const http = require('http')
const PORT = 8000
const server = http.createServer ((req, res) => {
    res.end("bi Hi")
})
server.listen(PORT, () => {
    console.log('server started...');
});


HTTP 서버에게 요청을 보내는 클라이언트 만들기

const PORT = 8000;
const http = require("http")
let count = 0
const options = {
        host: "192.168.0.6",
        port: 8000,
        path: "/"
}
if (true) {
    let bi = setInterval(() => {
        const req = http.request(options, (res) => {
            res.on('end', () => {
            })
        })
        req.end()
        count += 1
        console.log(count)
    }, 0.0001)
    setTimeout(()=>{clearInterval(bi)}, 10000)
}

숫자가 오르다 말고 오류가 떳다.

터미널 분활을 할 생각을 못해서 서버를 닫고 실행했던게 문제였다.

서버를 열고 다시 실행해보니 오류 없이 숫자가 오르긴 했다.

이게 맞는지 잘 모르겠다.

0개의 댓글