Sponsored Content
Top Forums Shell Programming and Scripting How to set timeout for dev/tcp while checking hostname and port? Post 302956104 by RudiC on Saturday 26th of September 2015 06:13:44 AM
Old 09-26-2015
Did you consider the nc (netcat) utility?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

timeout opening writing control channel /dev/initctl problem occur i cant shoudown

Hi... This is message that occurs when i am trying to shutdown the linux system timeout opening writing control channel /dev/initctl how can i shutdown what is the problem here.. Thanks in advance ... (2 Replies)
Discussion started by: arunkumar_mca
2 Replies

2. Programming

How to set the timeout for the client

The scenerio is: 1. A server listens on a port number 2. If the server is down and the Client tries to connect 3. How to set the timeout for the client Detailed explaination: In a client server architecture over a TCP/IP, normally the server is started first which waits and listens for the... (1 Reply)
Discussion started by: shilpi_gup
1 Replies

3. Shell Programming and Scripting

how to set timeout?

When I run a script where the 1st parameter is ip address ftp -n -i -v $1 I hang here if the ip is wrong how to set a timeout something like if (20s not complete "ftp -n -i -v $1") then echo "error" fi Thanks a lot. (14 Replies)
Discussion started by: uativan
14 Replies

4. Solaris

ndd /dev/tcp help

Solaris 10 server (SunOS 5.10 Generic_137137_09) I have a services file configured in /etc in there windows clients connect to my server on port 6034-6037 when I do the following netstat | grep TestServices it pulls all the connections active for those ports so right now I have 10 clients... (3 Replies)
Discussion started by: deaconf19
3 Replies

5. UNIX for Dummies Questions & Answers

Is it possible to set a timeout for rpcinfo?

I've created a script that checks the health of a piece of equipment out in the field by first establishing that it is pingable, and then parsing log files to gather information. Today I realized that there are times where the equipment may be pingable, and will not show any immediate issues in... (1 Reply)
Discussion started by: DeCoTwc
1 Replies

6. SCO

/dev/inet/tcp not listening in SCO 6.

While in SCO Openserver 5.0.7, Sybase listened to /dev/inet/tcp, the same is not working in SCO Openserver 6. The Network card is however active and pinging fine. What can be the reason? What is the way out? An early response will be appreciated. Thank you Regards TCG (2 Replies)
Discussion started by: thecobolguy
2 Replies

7. Solaris

ndd -set /dev/tcp tcp_host_param

Following command was set up in startup script on Solaris 8 servers - improved network transfers of files from one server to the another (doubled transfer speed). ndd -set /dev/tcp tcp_host_param '10.140.20.10 sendspace 279600 recvspace 279600 timestamp 1' Now they are getting a new server... (15 Replies)
Discussion started by: RTM
15 Replies

8. Shell Programming and Scripting

set Net:SSH:Expect timeout and set it again.

SSHing into a machine can take a few seconds, but after I'm in, the commands return quickly. I was wondering if the timeout setting can be changed once I'm logged into the machine. Does anyone know if this can be set on the fly? The problem here is, if I have to set timeout = 10, it'll take 10... (1 Reply)
Discussion started by: mrwatkin
1 Replies

9. IP Networking

Tcp ip port open but no such process (merged: Release A Port)

i want to kill a tcp connection by killing its pid with netstat -an i got the tcp ip connection on port 5914 but when i type ps -a or ps-e there is not such process running on port 5914 is it possible that because i do not log on with proper user account i can not see that process running? (30 Replies)
Discussion started by: alinamadchian
30 Replies

10. Red Hat

How to solve TCP connection timeout (not in ssh)?

HI We have some Red Hat Linux Sevres which is having TCP connection timeout, not SSH connection, as an example oracle connection connected from TOD. SSH i managed to add keepalive and it's working fine (1 Reply)
Discussion started by: bentech4u
1 Replies
NC(1)							      General Commands Manual							     NC(1)

NAME
nc - TCP/IP swiss army knife SYNOPSIS
nc [-options] hostname port[s] [ports] ... nc -l -p port [-options] [hostname] [port] DESCRIPTION
netcat is a simple unix utility which reads and writes data across network connections, using TCP or UDP protocol. It is designed to be a reliable "back-end" tool that can be used directly or easily driven by other programs and scripts. At the same time, it is a feature-rich network debugging and exploration tool, since it can create almost any kind of connection you would need and has several interesting built- in capabilities. Netcat, or "nc" as the actual program is named, should have been supplied long ago as another one of those cryptic but standard Unix tools. In the simplest usage, "nc host port" creates a TCP connection to the given port on the given target host. Your standard input is then sent to the host, and anything that comes back across the connection is sent to your standard output. This continues indefinitely, until the network side of the connection shuts down. Note that this behavior is different from most other applications which shut everything down and exit after an end-of-file on the standard input. Netcat can also function as a server, by listening for inbound connections on arbitrary ports and then doing the same reading and writing. With minor limitations, netcat doesn't really care if it runs in "client" or "server" mode -- it still shovels data back and forth until there isn't any more left. In either mode, shutdown can be forced after a configurable time of inactivity on the network side. And it can do this via UDP too, so netcat is possibly the "udp telnet-like" application you always wanted for testing your UDP-mode servers. UDP, as the "U" implies, gives less reliable data transmission than TCP connections and some systems may have trouble sending large amounts of data that way, but it's still a useful capability to have. You may be asking "why not just use telnet to connect to arbitrary ports?" Valid question, and here are some reasons. Telnet has the "standard input EOF" problem, so one must introduce calculated delays in driving scripts to allow network output to finish. This is the main reason netcat stays running until the *network* side closes. Telnet also will not transfer arbitrary binary data, because certain characters are interpreted as telnet options and are thus removed from the data stream. Telnet also emits some of its diagnostic messages to standard output, where netcat keeps such things religiously separated from its *output* and will never modify any of the real data in transit unless you *really* want it to. And of course telnet is incapable of listening for inbound connections, or using UDP instead. Netcat doesn't have any of these limitations, is much smaller and faster than telnet, and has many other advantages. OPTIONS
-c string specify shell commands to exec after connect (use with caution). The string is passed to /bin/sh -c for execution. See the -e option if you don't have a working /bin/sh (Note that POSIX-conformant system must have one). -e filename specify filename to exec after connect (use with caution). See the -c option for enhanced functionality. -g gateway source-routing hop point[s], up to 8 -G num source-routing pointer: 4, 8, 12, ... -h display help -i secs delay interval for lines sent, ports scanned -l listen mode, for inbound connects -n numeric-only IP addresses, no DNS -o file hex dump of traffic -p port local port number (port numbers can be individual or ranges: lo-hi [inclusive]) -q seconds after EOF on stdin, wait the specified number of seconds and then quit. If seconds is negative, wait forever. -b allow UDP broadcasts -r randomize local and remote ports -s addr local source address -t enable telnet negotiation -u UDP mode -v verbose [use twice to be more verbose] -w secs timeout for connects and final net reads -z zero-I/O mode [used for scanning] -T type set TOS flag (type may be one of "Minimize-Delay", "Maximize-Throughput", "Maximize-Reliability", or "Minimize-Cost".) COPYRIGHT
Netcat is entirely my own creation, although plenty of other code was used as examples. It is freely given away to the Internet community in the hope that it will be useful, with no restrictions except giving credit where it is due. No GPLs, Berkeley copyrights or any of that nonsense. The author assumes NO responsibility for how anyone uses it. If netcat makes you rich somehow and you're feeling generous, mail me a check. If you are affiliated in any way with Microsoft Network, get a life. Always ski in control. Comments, questions, and patches to hobbit@avian.org. NOTES
Some port names in /etc/services contain hyphens -- netcat currently will not correctly parse those unless you escape the hyphens with backslashes (e.g. "netcat localhost 'ftp-data'"). BUGS
Efforts have been made to have netcat "do the right thing" in all its various modes. If you believe that it is doing the wrong thing under whatever circumstances, please notify me and tell me how you think it should behave. If netcat is not able to do some task you think up, minor tweaks to the code will probably fix that. It provides a basic and easily-modified template for writing other network applications, and I certainly encourage people to make custom mods and send in any improvements they make to it. Continued feedback from the Internet community is always welcome! EXAMPLES
For several netcat recipes, please see /usr/share/doc/netcat/README.gz and /usr/share/doc/netcat/README.Debian.gz. AUTHOR
This manual page was written by Joey Hess <joeyh@debian.org> and Robert Woodcock <rcw@debian.org>, cribbing heavily from Netcat's README file. Netcat was written by a guy we know as the Hobbit <hobbit@avian.org>. NC(1)
All times are GMT -4. The time now is 10:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy