Maximum number of concurrent connections on a single port (socket) of Server

This depends in part on your operating system. There is however no limit on a specific port. There is a limit on the number of concurrent connections however, typically limited by the number of file descriptors the kernel supports (eg 2048). The thing to remember is that a TCP connection is unique and a connection … Read more

Using conditional statements inside ‘expect’

Have to recomment the Exploring Expect book for all expect programmers — invaluable. I’ve rewritten your code: (untested) proc login {user pass} { expect “login:” send “$user\r” expect “password:” send “$pass\r” } set username spongebob set passwords {squarepants rhombuspants} set index 0 spawn telnet 192.168.40.100 login $username [lindex $passwords $index] expect { “login incorrect” { … Read more

Creating a script for a Telnet session?

I’ve used various methods for scripting telnet sessions under Unix, but the simplest one is probably a sequence of echo and sleep commands, with their output piped into telnet. Piping the output into another command is also a possibility. Silly example (echo password; echo “show ip route”; sleep 1; echo “quit” ) | telnet myrouter … Read more

get all keys set in memcached

Found a way, thanks to the link here (with the original google group discussion here) First, Telnet to your server: telnet 127.0.0.1 11211 Next, list the items to get the slab ids: stats items STAT items:3:number 1 STAT items:3:age 498 STAT items:22:number 1 STAT items:22:age 498 END The first number after ‘items’ is the slab … Read more

Difference between wscript and cscript

In Windows, an executable is either a console application or a Windows application (or a SFU or Native application, but that doesn’t matter here). The kernel checks a flag in the executable to determine which. When starting using CreateProcess WinAPI function, if it is a console application, the kernel will create a console window for … Read more

What does “\r” do in the following script?

The ‘\r’ character is the carriage return, and the carriage return-newline pair is both needed for newline in a network virtual terminal session. From the old telnet specification (RFC 854) (page 11): The sequence “CR LF”, as defined, will cause the NVT to be positioned at the left margin of the next print line (as … Read more