address length help!

This is a discussion on address length help! within the C++ Programming forums, part of the General Programming Boards category; is there anything wrong with this? Code: int addresslen; ... addresslen = sizeof(remoteip); if ((newfd = accept(listen_sock, (struct sockaddr *) ...

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    88

    address length help!

    is there anything wrong with this?

    Code:
    int addresslen;
    ...
    addresslen = sizeof(remoteip);
    if ((newfd = accept(listen_sock, (struct sockaddr *) &remoteip, &addresslen)) == -1)
    {
    perror("accept");
    }
    g++ said that i changed signedness in the 3rd parameter (addresslen). i dont know what this means. thx.

    oh the program can compile if i make it
    Code:
    unsigned int addresslen
    but then the program doesnt work!
    Last edited by lithium; 01-24-2003 at 12:29 AM.

  2. #2
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    That means that one of the arguments you are passing is signed when you are supposed to pass an unsigned value or visa versa.

    Check the function's documentation and see which parameters are supposed to be signed and which are supposed to be unsigned and change the variables accordingly.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 09-04-2008, 02:27 PM
  2. address out of bounds in sockets program
    By newbie_socketsp in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-05-2008, 07:41 AM
  3. DX - CreateDevice - D3DERR_INVALIDCALL
    By Tonto in forum Game Programming
    Replies: 3
    Last Post: 12-01-2006, 07:17 PM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. array length
    By Wick in forum C++ Programming
    Replies: 3
    Last Post: 08-30-2003, 05:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21