Telnet to port

can some one help me ?

what happens when we telnet to a port ?
example
telnet 192.168.0.xx 1234

where 1234 is a port number

Thank you

You'll have to be more specific on what you want to know. Basically, the telnet command will try to establish a TCP connection to the gives address (IP+Port) using the underlying network stack. What happens afterward depends on the hardware in between, any firewalls and ACLs in effect, and the service listening on the other side (if any).

Telnetting to a particular port rather than the standard port 23 for telnet can be a useful test to see if something is listening on a port, e.g. to see if a machine is running a SSH daemon on port 22 the you do:

$ telnet localhost 22
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
SSH-2.0-OpenSSH_5.1p1 Debian-6ubuntu2
^]
telnet> quit
Connection closed.
$ 

Whereas testing to see if my machine (or a remote machine) is serving DNS:

$ telnet localhost 53
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
$

in this case the answer is not...

try to run the following command on the DNS Server

 netstat -an 

and check if bind is started and listening on the 53 port number

Running

$ telnet <remotemachine> netstat

can be useful on machines that have not been hardened.

Thank you