2018/12

2018/12

    Node.js 기본 코드 2 TCP Server Client

    참고 URL : http://ourcstory.tistory.com/67?category=664896 TCP_SERVER.JS /** * http://usejsdoc.org/ */ // http://ourcstory.tistory.com/67?category=664896 var net = require('net'); var server = net.createServer(function(socket){ console.log(socket.address().address + " connected."); // client request socket.on('data', function(data) { console.log('rcv:'+data) }); // client disconnect socket.on('clo..

    Node.js 기본 코드

    참고 블로그: - http://ourcstory.tistory.com/66?category=664896 var http = require('http');http.createServer(function handler(req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.end('Hello World\n');}).listen(1337, '127.0.0.1');console.log('Server running at http://127.0.0.1:1337/'); /* OS 관련 테스트 */var os = require('os');console.log(os.hostname());console.log(os.type());console.log(os.p..