PHP와 같이 nodejs에 socket을 작성해야합니다. PHP 언어에서 다음과 같은 것을합니다 :nodejs의 소켓
$http_request = "POST $path HTTP/1.0\r\n";
$http_request .= "Host: $host\r\n";
$http_request .= "User-Agent: Picatcha/PHP\r\n";
$http_request .= "Content-Length: " . strlen($data) . "\r\n";
$http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
$http_request .= "\r\n";
$http_request .= $data;
$response = '';
$fs = @fsockopen($host, $port, $errno, $errstr, 10)
if (FALSE == $fs) {
die('Could not open socket');
}
fwrite($fs, $http_request);
nodejs 서버에서 어떻게해야합니까?