发送数据
var http = require('http')
var options = {hostname:'localhost',port:8888,path:'/', method:'POST'}
var req = http.request(options)
req.write('你好')
req.end('再见')
接收数据
var http = require('http')
var server = http.createServer(function(req,res){
if(req.url !== '/favicon.ico'){
req.on('data',function(data){
console.log('服务器接受到数据:' + data)
res.end()
})
}
}).listen(8888,'localhost')