PDA

View Full Version : Correct netcat usage



Raspi+MIPS
2014-01-15, 02:30
Hi everybody,

is there a way to execute several cli commands in one step, avoiding latencies from multiple connections?

This gives me only the answer to the first query (artist):


echo -e "$playermac artist ?\n$playermac album ?\n$playermac title ?\nexit"| netcat 192.168.1.100 9090

Thanks all!

adhawkins
2014-01-15, 04:07
Hi,

In article <RaspiMIPS.67za7b (AT) no-mx (DOT) forums.slimdevices.com>,
Raspi+MIPS<RaspiMIPS.67za7b (AT) no-mx (DOT) forums.slimdevices.com> wrote:
> is there a way to execute several cli commands in one step, avoiding
> latencies from multiple connections?
>
> This gives me only the answer to the first query (artist):
>
>
> Code:
> --------------------
> echo -e "$playermac artist ?\n$playermac album ?\n$playermac title ?\nexit"| netcat 192.168.1.100 9090
> --------------------

Does adding a delay in help?

I think it's the '-i' switch to netcat.

So

echo -e "...." | netcat -i 1 ip port

Andy

DJanGo
2014-01-15, 11:57
Hi everybody,

is there a way to execute several cli commands in one step, avoiding latencies from multiple connections?

This gives me only the answer to the first query (artist):


echo -e "$playermac artist ?\n$playermac album ?\n$playermac title ?\nexit"| netcat 192.168.1.100 9090

Thanks all!

Hi,

4 shure - your cmdline if *ux - so install expect and put all your "questions" to the cli in on expectphrase - may you should add a sleep .5 - or 1 to each question - but how do you want to find out - which answer is from which question?.

Raspi+MIPS
2014-01-15, 14:33
Hi,

4 shure - your cmdline if *ux - so install expect and put all your "questions" to the cli in on expectphrase - may you should add a sleep .5 - or 1 to each question - but how do you want to find out - which answer is from which question?.

This seems to be an option, though I have to find a quiet moment to check this out, as I did not get it to work on the first try.

Thanks!