FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TypeScriptSamples/node/src/TcpServer.ts at master · fred7BF/TypeScriptSamples · GitHub
fred7BF
TypeScriptSamples
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
TypeScriptSamples
/
node
/
src
/
TcpServer.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
14 lines (11 loc) · 327 Bytes
Breadcrumbs
TypeScriptSamples
/
node
/
src
/
TcpServer.ts
Copy path
File metadata and controls
14 lines (11 loc) · 327 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/**
* TCP server example.
*/
import
{
createServer
,
Socket
}
from
'net'
;
const
host
=
'localhost'
;
const
port
=
1337
;
const
server
=
createServer
(
(
socket
:
Socket
)
=>
{
socket
.
write
(
'Echo server\r\n'
)
;
socket
.
pipe
(
socket
)
;
}
)
;
server
.
listen
(
port
,
host
,
(
)
=>
{
console
.
log
(
`Server running at
${
host
}
:
${
port
}
`
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL