was node和server之间通过哪些端口
答案:2 悬赏:10 手机版
解决时间 2021-03-22 10:52
- 提问者网友:世勋超人
- 2021-03-21 10:05
was node和server之间通过哪些端口
最佳答案
- 五星知识达人网友:空山清雨
- 2021-03-21 10:27
SQL Server的服务端口一般安装是默认为1433,只要此端口开放,那么客户端就可以连接到此SQL Server 2008的服务。而SQL Server 2008服务本身的运行并不需要指定的端口,1433只是让客户端可以与服务通讯的端口。
全部回答
- 1楼网友:荒野風
- 2021-03-21 11:58
如果是要退出node命令的话,可以使用:selection_076
js代码 收藏代码
$ node
> 9+23
32
> process.exit()
$
或者
js代码 收藏代码
$ node
> 9+23
32
> .exit
$
如果是要退出node server的话,可以使用:selection_077
selection_080
别人是推荐点击两下 ctrl-c, 但是我使用的时候不好使,不知道是不是因为需要大写的c才行,所以我使用 ctrl-shift-c 的时候就可以了,不过这个快捷键需要结合下面的代码使用:
js代码 收藏代码
// this function is called when you want the server to die gracefully
// i.e. wait for existing connections
var gracefulshutdown = function() {
console.log("received kill signal, shutting down gracefully.");
server.close(function() {
console.log("closed out remaining connections.");
process.exit()
});
// if after
settimeout(function() {
console.error("could not close connections in time, forcefully shutting down");
process.exit()
}, 10*1000);
}
// listen for term signal .e.g. kill
process.on ('sigterm', gracefulshutdown);
// listen for int signal e.g. ctrl-c
process.on ('sigint', gracefulshutdown);
全部的代码为:
js代码 收藏代码
var express = require('express');
var app = express();
// listen on the specified port
var server = app.listen(8080);
// serve out content
app.get('/', function(req, res){
var body = 'hello world';
res.setheader('content-type', 'text/plain');
res.setheader('content-length', body.length);
res.end(body);
});
// this function is called when you want the server to die gracefully
// i.e. wait for existing connections
var gracefulshutdown = function() {
console.log("received kill signal, shutting down gracefully.");
server.close(function() {
console.log("closed out remaining connections.");
process.exit()
});
// if after
settimeout(function() {
console.error("could not close connections in time, forcefully shutting down");
process.exit()
}, 10*1000);
}
// listen for term signal .e.g. kill
process.on ('sigterm', gracefulshutdown);
// listen for int signal e.g. ctrl-c
process.on ('sigint', gracefulshutdown);
因为点击ctrl-shift-c之后就会触发process函数。
或者使用:selection_081
ctrl-z 之后,使用
c代码 收藏代码
ps aux | grep node
kill -9 pid
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯