Starting a TCP server from terminal
Asked Answered
U

1

15

How do I start a TCP server from the terminal on port 13370 using nc? I was following a tutorial that required starting up a TCP server on 13370 and send requests through it. The tut advised me to open the TCP server using "nc" How do I go on achieving this?

Urogenital answered 16/7, 2015 at 6:47 Comment(1)
Have you read the manual page for nc? Most versions include some pretty clear examples.Embezzle
G
43

From nc documentation:

It is quite simple to build a very basic client/server model using nc. On one console, start nc lis-tening listening on a specific port for a connection

You should use -l parameter, for listening on port 13370:

$ nc -l 13370

Now you have a tcp server on 127.0.0.1:13370

On a second console you could connect to your server by using:

$ nc 127.0.0.1 13370

Please refer also to the documentation link.

Grantgranta answered 16/7, 2015 at 6:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.