File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 20
20
// USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
22
22
'use strict' ;
23
- const common = require ( '../common' ) ;
23
+ require ( '../common' ) ;
24
24
const assert = require ( 'assert' ) ;
25
25
const net = require ( 'net' ) ;
26
26
@@ -32,8 +32,6 @@ let npauses = 0;
32
32
console . log ( 'build big string' ) ;
33
33
const body = 'C' . repeat ( N ) ;
34
34
35
- console . log ( `start server on port ${ common . PORT } ` ) ;
36
-
37
35
const server = net . createServer ( ( connection ) => {
38
36
connection . write ( body . slice ( 0 , part_N ) ) ;
39
37
connection . write ( body . slice ( part_N , 2 * part_N ) ) ;
@@ -44,9 +42,11 @@ const server = net.createServer((connection) => {
44
42
connection . end ( ) ;
45
43
} ) ;
46
44
47
- server . listen ( common . PORT , ( ) => {
45
+ server . listen ( 0 , ( ) => {
46
+ const port = server . address ( ) . port ;
47
+ console . log ( `server started on port ${ port } ` ) ;
48
48
let paused = false ;
49
- const client = net . createConnection ( common . PORT ) ;
49
+ const client = net . createConnection ( port ) ;
50
50
client . setEncoding ( 'ascii' ) ;
51
51
client . on ( 'data' , ( d ) => {
52
52
chars_recved += d . length ;
You can’t perform that action at this time.
0 commit comments