c - How can i avoid mulitple raw socket bind to the same ip address? -
actually, if create multiple raw sockets same ip address. bind of them, , consequently packets received sockets.
is there way avoided, such other process trying bind same ip address receives error?
i using raw socket
#include <sys/socket.h> #include <netinet/in.h> raw_socket = socket(af_inet, sock_raw, int protocol); in man page raw(7)
a raw socket can bound specific local address using bind(2) call. if isn't bound packets specified ip protocol received. in addition raw socket can bound specific network device using so_bindtodevice; see socket(7).
you cannot bind raw socket specific port because "port" concept in tcp , udp, not ip. sneek @ header diagrams 3 protocols , should become obvious: working @ lower level, concept of port not known. understand regarding port numbers.
no. mere fact raw means there's no other protocol except raw internet protocol. without tcp or udp, there won't port distinguish application packet gets sent to, instead, have filtered through ip packet's payload. you'd have manually. best way make program forwards these packets after inspection wherever want go.
Comments
Post a Comment