简体   繁体   English

关于app.listen(端口,主机名)和server.createServer()的困惑

[英]Confusion about app.listen(port, hostname) and server.createServer()

I know that app.listen(port, hostname) makes the system listen for a specific socket but do I write this code in the client-side computer or server-side computer? 我知道app.listen(port,hostname)使系统侦听特定的套接字,但是我是否在客户端计算机或服务器端计算机中编写此代码? Also server.createServer() creates a server but is this code written in the client-side computer or server-side computer?? 另外server.createServer()创建服务器,但是此代码是写在客户端计算机还是服务器端计算机上? (this confusion happened because I was localhosting and my computer was both client-side and server-side at the same time). (发生这种混乱是因为我在本地主机中并且我的计算机同时在客户端和服务器端)。

这两段代码都在服务器端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM