gethostbyname relies on a functioning DNS system. Make sure things like nslookup and traceroute work properly. The other place you might be going wrong is that in a scalar context, gethostbyname returns the packed ip address, though I'm not sure why you're looking up the hostname from a hostname to begin with.
As for the printing issue, I suspect that you are Suffering from Buffering.
Update: oops, gethostbyname is irrelevant here but the DNS still needs to work.
In reply to Re^4: Socket deadlock doubt in code
by rowdog
in thread Socket deadlock doubt in code
by sajanagr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |