Thread: Help regarding raw sockets.

  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    5

    Help regarding raw sockets.

    Hi all

    I am currently working on a project where I need to prioritize the traffic in a network. For this I am planning to modify the ip headers of the packets that I send over the network.

    First of all, is this the right approach?

    If it is, I think I will have to use raw sockets for this to be possible.
    Can I build my own ip headers and append it to the packets that I am sending over the network so that they are prioritized according to my needs?

    Can this be done?
    If yes, can someone please tell me how?

    Any help would be greatly appreciated.

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    I would advise you look into some "QoS" facility that may already be available instead of trying to do this in code.

    Soma

  3. #3
    Registered User
    Join Date
    Jul 2012
    Posts
    5
    Thanks Soma. Can you tell me how to use the QoS facilities?
    I am new to networking and don't have much of a clue how things exactly work.

  4. #4
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    Packets in IPv6 have a part(priority) of them that informs the network if they are too important and have to be transmitted first.However this is implied at the network level and i do not know if a programmer can interfere.

  5. #5
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    Can you tell me how to use the QoS facilities?
    I obviously can not because I have no idea what facilities, software, and hardware may be available to you.

    A lot of routers, even consumer routers, have some form of "QoS" available that may allow you to grant a particular sender, recipient, protocol, or port priority over others.

    How you may do this depends upon... everything.

    As I said, look into what you have available.

    Soma

  6. #6
    Registered User
    Join Date
    Jul 2012
    Posts
    5
    Ya that was what I was saying. The field is called DSCP (Differential services code point) which i think allows you to prioritize packets.
    And I read some stuff regarding the same and found out that you need to use raw sockets as against SOCK_STREAM and SOCK_DGRAM to be able to modify it.
    I am used to using the other two most of the time. This is the first time I am using raw sockets.
    They are also not supported in getaddrinfo() I guess. Has anyone of you ever programmed using SOCK_RAW before?

  7. #7
    Registered User
    Join Date
    Jul 2012
    Posts
    5
    I will do that Soma. Thanks.

  8. #8
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    Quote Originally Posted by Technofreak View Post
    Ya that was what I was saying. The field is called DSCP (Differential services code point) which i think allows you to prioritize packets.
    And I read some stuff regarding the same and found out that you need to use raw sockets as against SOCK_STREAM and SOCK_DGRAM to be able to modify it.
    I am used to using the other two most of the time. This is the first time I am using raw sockets.
    They are also not supported in getaddrinfo() I guess. Has anyone of you ever programmed using SOCK_RAW before?
    I am sorry but not.However i hope that the above info helped you a bit

  9. #9
    Registered User
    Join Date
    Jul 2012
    Posts
    5
    It did. Thank you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sockets tutorial, datagram sockets example not working for me
    By caesius in forum Networking/Device Communication
    Replies: 14
    Last Post: 12-26-2009, 03:40 PM
  2. Sockets in C++
    By abyssphobia in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-18-2004, 03:54 PM
  3. sockets with VC++ and C#
    By mduarte in forum Networking/Device Communication
    Replies: 1
    Last Post: 01-19-2004, 11:41 AM
  4. sockets
    By eldian() in forum C++ Programming
    Replies: 3
    Last Post: 04-28-2003, 07:08 AM
  5. help with sockets
    By fbplayr78 in forum C++ Programming
    Replies: 1
    Last Post: 04-13-2003, 08:55 PM

Tags for this Thread