Mô- đun mạng Node.js
Định nghĩa và cách sử dụng
Mô-đun Net cung cấp cách tạo máy chủ TCP và máy khách TCP.
Cú pháp
Cú pháp để đưa mô-đun Net vào ứng dụng của bạn:
var net = require('net');
Thuộc tính và phương thức ròng
Method | Description |
---|---|
connect() | Creates a new connection to the server, and returns a new Socket |
createConnection() | Creates a new connection to the server, and returns a new Socket |
createServer() | Creates a new server |
isIP | Checks if the specified value is an IP address |
isIPv4 | Checks if the specified value is an IPv4 address |
isIPv6 | Checks if the specified value is an IPv6 address |