c - How to convert SOCK_DGRAM to SOCK_RAW? -


i'm working on open source sock_dgram used send rtp packets.

like this:

 int sock = socket(af, sock_dgram, 0); 

but i'm supposed use same socket sock_raw send udp packets prepare.

is possible convert udp socket raw socket?

if possible how can done?

thanks in advance

i don't know why said need use same socket, otherwise, can follow below steps transfer packet on raw socket.

  1. create socket using sock_raw.
  2. define , populate ip header [struct ipheader]
  3. define , populate udp header [struct udphdr]
  4. set socket not use system (kernel) provied header [setsockopt() ip_hdrinclas 1]
  5. send buffer [sendto()]

you can find nice tutorials (and maybe sample codes, too) here.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -