File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
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
@@ -54,10 +54,11 @@ const echo_server = net.createServer((socket) => {
5454 } ) ;
5555} ) ;
5656
57- echo_server . listen ( common . PORT , ( ) => {
58- console . log ( `server listening at ${ common . PORT } ` ) ;
57+ echo_server . listen ( 0 , ( ) => {
58+ const port = echo_server . address ( ) . port ;
59+ console . log ( `server listening at ${ port } ` ) ;
5960
60- const client = net . createConnection ( common . PORT ) ;
61+ const client = net . createConnection ( port ) ;
6162 client . setEncoding ( 'UTF8' ) ;
6263 client . setTimeout ( 0 ) ; // Disable the timeout for client
6364 client . on ( 'connect' , ( ) => {
You can’t perform that action at this time.
0 commit comments