Networking
cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use raw socket to capture packets on HP-UX 11.23?

jacky823
Occasional Visitor

Can I use raw socket to capture packets on HP-UX 11.23?

Hi
I hope to capture packets on net card.I try to use raw socket to do it. But it can't return any BYTES.
sockd = socket(AF_INET,SOCK_RAW,);
recvfrom(sockd,buf,BUF_SIZE,0,0,&d);
The thread suspend in recvfrom and can't return any words.
Can you tell me how can I capture packets in program?
3 REPLIES
rick jones
Honored Contributor

Re: Can I use raw socket to capture packets on HP-UX 11.23?

You need to install and use libpcap.
there is no rest for the wicked yet the virtuous have no pillows
jacky823
Occasional Visitor

Re: Can I use raw socket to capture packets on HP-UX 11.23?

Hi rick:
Do you think we can't receive all packages on netcard with RAW SOCKET on HP-UX? I hnow we can do it on linux.
rick jones
Honored Contributor

Re: Can I use raw socket to capture packets on HP-UX 11.23?

HP-UX and Linux are different operating systems. Sometimes there is more to porting than just a recompile :)

If you want to capture the traffic arriving/departing a network interface, on HP-UX you use DLPI and promiscuous mode. Libpcap provides a higher-level abstraction so you do not have to know about DLPI.
there is no rest for the wicked yet the virtuous have no pillows