dcsimg
Results 1 to 2 of 2

Thread: I have a question about Winsock API

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2008
    Posts
    961

    I have a question about Winsock API

    If I'm wanting to create my own protocol and therefore using raw IP packets (instead of TCP/IP or UDP/IP), which protocol constant should I use when creating my socket? By looking at sockets.h it seems I have 2 possibilities.
    #define IPPROTO_IP 0 // dummy for IP
    #define IPPROTO_RAW 255 // raw IP packet

    Which constant should I use? One sounds a bit more raw than the other. But I'm not entirely sure.

  2. #2
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    4,583

    Re: I have a question about Winsock API

    It seems like since you asked this seven hours ago, you probably already had time to spend a few seconds to do a search, and maybe a minute or two to read one of the first hits, so this will be old news.
    Bottom line, if you use IPPROTO_IP, then the protocol will be auto selected based on socket type, i.e. you specify a streaming socket, you get TCP protocol.

    If you want RAW, use RAW. Now instead of being at level 4 (i.e. UDP and TCP are "above" IP, so level 4). Raw is at the IP level (level 3). I think I've only had to deal with one hardware device that required interfacing at the IP level (with "raw" packets).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width