LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-05-2012, 03:09 AM   #1
installer69
LQ Newbie
 
Registered: May 2012
Posts: 4

Rep: Reputation: Disabled
netcat hostname question


Hi,
I am using netcat to send some text from a linux tablet to my windows laptop.

All works perfect if I specify the ip address of the laptop.

Is it possible to specify the computer name instead and if so in what format. I have tried ron-PC and WORKGROUP\ron-PC but netcat says 'forward host lookup failed: Unknown host.

Before anyone suggests it, yes I know I can set a static ip address for the laptop but I have a lot of devices on the network that I will need to broadcast to so am trying to avoid setting static ips on them all. And I just want to see if the other way is possible now I have the bit between my teeth.

I'm using a perl script to system call netcat if anyone has any other suggestions like how to see what active computers are on the network, grab their ip addresses, chuck them in a string and use them in netcat (don't ask for much, do I)

If I do end up setting statics and listing them all for netcat can anyone tell me what command flag to use to prevent netcat hanging if one of the computers are off?

Thanks for any input.
 
Old 05-05-2012, 03:28 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If you don't use a name server, are you using avahi? If so try ron-PC.local as the hostname.
 
Old 05-05-2012, 03:46 AM   #3
installer69
LQ Newbie
 
Registered: May 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thank you so much. I spent a couple of hours searching the net with all possible search terms that might lead me to an answer and despite all that time looking none of the results mentioned avahi. I googled it, read about it and inserted it just as you suggested and it worked. Thank you so much, I can now send caller id to all devices around the house.

Just one last question, will it degrade gracefully if ron-PC (for example) is off or will it hang?

Last edited by installer69; 05-05-2012 at 03:48 AM. Reason: more info
 
Old 05-05-2012, 06:16 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
It will probably hang for around 5 seconds waiting for a response.

At home, I entered the IP addresses I want assigned to my hosts in my router's IP/MAC clients' table. This way, I can use DHCP on the hosts but still have fixed addresses, and maintain an /etc/hosts file.

Last edited by jschiwal; 05-05-2012 at 06:19 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
netcat question redss Linux - Software 2 09-26-2009 01:17 PM
Newbie Install Question Netcat Jagtek Linux - Newbie 8 04-04-2006 06:38 PM
Hostname question GUIPenguin Linux - Networking 1 01-18-2005 08:59 PM
netcat question overbored Linux - Software 13 10-30-2004 04:26 PM
Netcat question igor8 Linux - Security 3 06-21-2004 12:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration