Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions test/parallel/test-child-process-fork-net.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const assert = require('assert');
const common = require('../common');
require('../common');
const fork = require('child_process').fork;
const net = require('net');

Expand Down Expand Up @@ -91,7 +91,7 @@ if (process.argv[2] === 'child') {
console.log('PARENT: server listening');
child.send({what: 'server'}, server);
});
server.listen(common.PORT);
server.listen(0);

// handle client messages
var messageHandlers = function(msg) {
Expand All @@ -100,7 +100,7 @@ if (process.argv[2] === 'child') {
// make connections
var socket;
for (var i = 0; i < 4; i++) {
socket = net.connect(common.PORT, function() {
socket = net.connect(server.address().port, function() {
console.log('CLIENT: connected');
});
socket.on('close', function() {
Expand Down Expand Up @@ -143,9 +143,9 @@ if (process.argv[2] === 'child') {
//
// An isolated test for this would be lovely, but for now, this
// will have to do.
server.listen(common.PORT + 1, function() {
server.listen(0, function() {
console.error('testSocket, listening');
var connect = net.connect(common.PORT + 1);
var connect = net.connect(server.address().port);
var store = '';
connect.on('data', function(chunk) {
store += chunk;
Expand Down