1827671 Members
3413 Online
109967 Solutions
New Discussion

Re: Sockets in unix

 
Manuales
Super Advisor

Sockets in unix

how can i know if a socket is woking into a server?
how can i test this one ?
please let me know...

Regards, Daniela.
10 REPLIES 10
Mridul Shrivastava
Honored Contributor

Re: Sockets in unix

check the outout of netstat...

For more details refer man pages , extract from man pages:

netstat -a Show the state of all sockets, including passive sockets used by server processes. When netstat is used without any options only active sockets are shown. This option does not show the state of X.25 programmatic access sockets.

The option is ignored if the -g, -i, -I, -M,
-p, -r, -s or interval option is specified.
Time has a wonderful way of weeding out the trivial
whiteknight
Honored Contributor

Re: Sockets in unix

Manuales,

you also can use lsof -i to display all the sockets in unix.

if you want to test the socket

eg:
telnet it is to verify the port is working.

WK
Problem never ends, you must know how to fix it
Manuales
Super Advisor

Re: Sockets in unix

is correct to found the following?:

tcp 0 0 unix28.1363 *.* LISTEN
tcp 0 0 unix28.53726 unix28.1363 ESTABLISHED
tcp 0 0 unix28.1363 unix28.53726 ESTABLISHED
udp 0 0 *.1363 *.*
unix28 87:

is correct to found 2 times the port 1363?
Manuales
Super Advisor

Re: Sockets in unix

I got the following:

server2 90: telnet 11.22.33.44 1364
Trying...
Connected to 11.22.33.44
Escape character is '^]'.

does this mean it worked?

whiteknight
Honored Contributor

Re: Sockets in unix

Manuales,


YES the port is working!!

WK
Problem never ends, you must know how to fix it
whiteknight
Honored Contributor

Re: Sockets in unix


Try this also

# lsof -nP -i tcp:1363


WK
Problem never ends, you must know how to fix it
A. Clay Stephenson
Acclaimed Contributor

Re: Sockets in unix

In a very real sense, your question has no meaning. While a "telnet ip_address port" can tell you something, it really doesn't tell you if a socket (or more properly a process bound to a socket) is working as it is supposed to. "Working" in this context only has meaning only if the server and client are talking to each other in a protocol that they mutually understand. For example, if you attempt to use an ftp client with a telnet server, sockets will be opened and they will communicate (albeit breifly) but I wouldn't describe that as working as the client is trying to send data that the server does not understand.
If it ain't broke, I can fix that.
Manuales
Super Advisor

Re: Sockets in unix

lsof does not work :( ....

is there other similar command?
Mridul Shrivastava
Honored Contributor

Re: Sockets in unix

lsof is the the internal built HPUX command .. this is a utility you have to download from internet and then run on the server...

Could you please let us know the reason behind checking the sockets.. what's the purpose..
Time has a wonderful way of weeding out the trivial
Ralph Grothe
Honored Contributor

Re: Sockets in unix

>tcp 0 0 unix28.1363 *.* LISTEN
>tcp 0 0 unix28.53726 unix28.1363 ESTABLISHED
>tcp 0 0 unix28.1363 unix28.53726 ESTABLISHED
>udp 0 0 *.1363 *.*
>unix28 87:
>
>is correct to found 2 times the port 1363?

It depends on what services your box is using or offering.
The second socket is UDP.
Here it is more difficult to check if the service listening there is working properly without knowledge of the application layer protocol further up the stack because a UDP datagram sent to this socket may never elicit a response.
Since UDP is said to be connection less there is no such mechanism as with the TCP three-way handshake (that you had successfully tested with your telnet connection) to prompt a reaction from a UDP listening socket.
All control is left to the application.

However, a look at IANA's port list may give a hint
http://www.iana.org/assignments/port-numbers

There you will find these entries:

ndm-requester 1363/tcp Network DataMover Requester
ndm-requester 1363/udp Network DataMover Requester

Perhaps these ports are also registered in your server's /etc/services.

Just check

$ grep [^0-9]1363/..p /etc/services
Madness, thy name is system administration