File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 2020// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121
2222'use strict' ;
23- const common = require ( '../common' ) ;
23+ require ( '../common' ) ;
2424const assert = require ( 'assert' ) ;
2525const net = require ( 'net' ) ;
2626
@@ -32,8 +32,6 @@ let npauses = 0;
3232console . log ( 'build big string' ) ;
3333const body = 'C' . repeat ( N ) ;
3434
35- console . log ( `start server on port ${ common . PORT } ` ) ;
36-
3735const server = net . createServer ( ( connection ) => {
3836 connection . write ( body . slice ( 0 , part_N ) ) ;
3937 connection . write ( body . slice ( part_N , 2 * part_N ) ) ;
@@ -44,9 +42,11 @@ const server = net.createServer((connection) => {
4442 connection . end ( ) ;
4543} ) ;
4644
47- server . listen ( common . PORT , ( ) => {
45+ server . listen ( 0 , ( ) => {
46+ const port = server . address ( ) . port ;
47+ console . log ( `server started on port ${ port } ` ) ;
4848 let paused = false ;
49- const client = net . createConnection ( common . PORT ) ;
49+ const client = net . createConnection ( port ) ;
5050 client . setEncoding ( 'ascii' ) ;
5151 client . on ( 'data' , ( d ) => {
5252 chars_recved += d . length ;
You can’t perform that action at this time.
0 commit comments