I decided to add a tap interface and use it in my code , but I am able to get its state UP.
sudo ip -f link tuntap add tap10 mode tap
sudo ip link set tap10 up
After this when I do "ip link"
tap10: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 500
link/ether 26:cc:d2:b4:37:ea brd ff:ff:ff:ff:ff:ff
state DOWN: How to get this state UP ? I am trying to send packets to it and nothing is received .