File tree Expand file tree Collapse file tree 1 file changed +12
-13
lines changed
blog/25-12-03/unix-sockets/ex Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Original file line number Diff line number Diff line change 99 // Clean up old socket file if it exists
1010 var fs = require ( 'fs' ) ;
1111
12- if ( fs . existsSync ( PIPE_PATH ) ) {
12+ if ( fs . existsSync ( PIPE_PATH ) ) {
1313 fs . unlinkSync ( PIPE_PATH ) ;
1414 }
1515
16- var server = net . createServer ( ( conn ) => {
17- console . log ( 'Client connected' ) ;
18-
19- conn . on ( 'data' , ( data ) => {
20- console . log ( 'Received from client:' , data . toString ( ) ) ;
16+ var server = net . createServer ( con => {
17+ console . log ( 'Client connected' ) ;
18+ con . on ( 'data' , data => {
19+ console . log ( 'Received from client:' , data . toString ( ) ) ;
2120 } ) ;
2221
23- conn . on ( 'end' , ( ) => {
24- console . log ( 'Client disconnected' ) ;
22+ con . on ( 'end' , ( ) => {
23+ console . log ( 'Client disconnected' ) ;
2524 } ) ;
26-
27- // Send a test message
28- conn . write ( 'Hello from Node server over Unix socket!' ) ;
25+ // Send a test message
26+ con . write ( 'Hello from Node server over Unix socket!' ) ;
27+
2928 } ) ;
3029
31- server . listen ( PIPE_PATH , ( ) => {
32- console . log ( 'Server listening on' , PIPE_PATH ) ;
30+ server . listen ( PIPE_PATH , ( ) => {
31+ console . log ( 'Server listening on' , PIPE_PATH ) ;
3332 } ) ;
3433
3534
You can’t perform that action at this time.
0 commit comments