Thread: How get the numeric values for bind in TCP/IPv6 for Linux

  1. #1
    Registered User
    Join Date
    Jul 2017
    Posts
    28

    Question How get the numeric values for bind in TCP/IPv6 for Linux

    Background:
    This is a C code for Linux question, so do not run when you see a different language plz.


    I am working in the LabVIEW environment on a sbRIO running Linux.

    I am trying to program IPv6 communication using C code for Linux.



    Question:
    The problem that I am currently having is finding the correct integers not constants to put into the various commands socket, bind etc... All of the examples on the web show constants instead of the actual integer value which I need.


    How/where can I find these integer values?


    What I Tried:
    I thought it might be in the header file, so I downloaded Cygwin and searched it for socket.h. I found it.


    After reading through socket.h from my Cygwin directory, I managed to find the numeric value for AF_INET6. Using the int socket(int domain, int type, int protocol) gives me an error if I use:

    domain = 23; // AF_INET6

    type = 1; // SOCK_STREAM

    protocol = 0; // DEFAULT


    however, it works if I use:



    domain = 10; // AF_CCITT

    type = 1; // SOCK_STREAM
    protocol = 0; // DEFAULT



    Reference: socket(2) - Linux manual page

    So how/where can I find these integer values and why is it not working when I put in the integer value for AF_INET6? Do different compilers/versions of Linux have different header files?


    Thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Error when someone enter non numeric values.
    By Austin Cutrona in forum C++ Programming
    Replies: 1
    Last Post: 02-06-2017, 01:32 PM
  2. Linux IPv6 Getting Started Problem
    By danjoe in forum Linux Programming
    Replies: 2
    Last Post: 01-29-2015, 02:19 PM
  3. problem with ipv6 sockets on bind
    By mushy in forum C Programming
    Replies: 1
    Last Post: 10-06-2010, 11:56 AM
  4. Replies: 10
    Last Post: 06-10-2010, 09:52 PM
  5. How to define a polymorphic function for numeric values
    By Adrian20XX in forum C++ Programming
    Replies: 5
    Last Post: 02-22-2009, 02:00 PM

Tags for this Thread