How to find if remote n/w port is listening on HP-UX from the binary

Hi,

I have an executable running on HP-UX, from this executable I need to findout if the portnumber. lets say 7890,7891, 7892 are listening on the remote server running on HP-UX.

I can do it by creating socket, connect etc. But is there any other way of doing it using "system()" function or any other?

I noticed that nmap, netcat are not available on HP-UX.

Please let me know. If I can manage this with passive connect.

Thanks
Einstein

Are you trying to determine the remote OS (if any) for a given socket? I'm confused.

the netstat command will do this for you. But it just gives you the dns name (or possibly the IP) address, you need to reverse engineer that into what you seem to want - is the remote system HPUX or not? Create a list of known HPUX boxes in your network. Search the list to see if the node you found is in the list.

1 Like

Do you have lsof installed? If so run lsof -i or lsof -p <pid>

1 Like

Let me explain it more clearly...

I have an Application running on HOST1 which multiple INTERFACES.. LAN1, LAN2, LAN3, LAN4. Every INTERFACE has different IP. Lets say.

LAN1 - 172.12.13.34
LAN2 - 194-23.4.56
LAN3 - .....
LAN4 - .....

I Have several other HOSTS with atleast 4 INTERFACES on them. But they dont have this application running on them. My application will be runing on HOST1 only.

Now I need to ping all other hosts from HOST1 LAN1, LAN2, LAN3, LAN4 ip's.

but ping -i uses multicast IP's to Multicast IP's only. So I am unable to use

ping -i 172.12.13.34 172.12.25.34.

It gives message as the source IP is not multicast. This is my problem.

How can use ping to use my LAN1, LAN2, LAN3, LAN4 ip's seperately and send icmp messages to check status of other hosts reachability.

please help.

Thanks
Einstein

---------- Post updated at 10:52 AM ---------- Previous update was at 10:32 AM ----------

I am running on HP-UX B.11.31 U ia64

lsof is for local host right... It doesn't let me know anything about remore host specific LAN interface reachability.

I should verify if I can reach

 HOST1.LAN1 to HOST2.LAN1 is reachable or not. 
HOST1.LAN2 to HOST2.LAN2 is reachable or not.
HOST1.LAN3 to HOST2.LAN3 is reachable or not.
HOST1.LAN4 to HOST2.LAN4 is reachable or not.

I should make sure

 
HOST1.LAN1 to HOST2.LAN2 is not reachable.

Please suggest me what I can do in this condition.
I want the solution to be implemented into application.

Thanks
Einstein