0

I have 2 terminals with title SERVER and CLIENT

I have setup a netcat listener on SERVER with below command

nc -lvp 12345

and from CLIENT i connect to it using

nc 127.0.0.1 12345


When ever a client connects to the server, i just want to be informed on server that a client has connected.

3
  • nc -lvp 12345 generates an error on my system (both Linux and FreeBSD). What netcat are you running? Commented Oct 16, 2015 at 14:41
  • netcat version is 1.10-41 Commented Oct 16, 2015 at 14:51
  • Interesting. That is not the netcat installed in my Ubuntu 10.04 box, where -p is used only to identify the source port for an outgoing connection. According to the man page, "It is an error to use this option in conjunction with the -l option." Commented Oct 16, 2015 at 15:04

1 Answer 1

3
(echo "Welcome"; cat) | nc -lvp 12345 
Sign up to request clarification or add additional context in comments.

8 Comments

i want to show welcome on my listener terminal, i.e. the first terminal in listen mode. But its showing welcome message on 2nd terminal :-)
@ZAZ, then you might want to update your question to clarify exactly what you're trying to do. While you're at it, perhaps you could add some context so that we know the greater problem you're trying to solve.
Send it with the client: (echo "Welcome"; cat) | nc 127.0.0.1 12345
either way, if you use the -v switch, nc will notify you when a client connects
@Alvaro its okay, there was a mistake at my end, thanks
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.