Unix - Checking defaults

This is a discussion on Unix - Checking defaults within the Networking/Device Communication forums, part of the General Programming Boards category; How do I check the send buffer size on a Unix system? This is probably right in front of me, ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    3

    Unix - Checking defaults

    How do I check the send buffer size on a Unix system?

    This is probably right in front of me, but I wouldn't know where to look.

  2. #2
    Registered User
    Join Date
    Sep 2004
    Posts
    197
    look into the getsockopt call and the option SO_SNDBUF layer as SOL_SOCKET and the rest is up to you to figure out.

    I found these in the socket(7) man page, and I also looked at the getsockopt(2) man page but Im still trying to figure some of it out.

    EDIT:
    ok, Im not that great with C, C++ is much more my style, but I threw together a simple little C program that checks what the send buffer size is. I didn't do any double checking, so this might be wrong, but might as well give it a shot, here is the code

    Code:
    #include <sys/socket.h>
    #include <sys/types.h>
    #include <stdio.h>
    
    int main(void)
    {
            int mysocket,buffsize,length;
            length = sizeof(int);
            mysocket = socket(PF_INET,SOCK_STREAM,6);
            getsockopt(mysocket, SOL_SOCKET,SO_SNDBUF,&buffsize,&length);
            printf("the send buff is %i bytes in size.\n", buffsize);
            return 0;
    }
    I got
    the send buff is 16384 bytes in size.
    for the output.
    Last edited by Xipher; 10-31-2005 at 07:25 PM.
    If any part of my post is incorrect, please correct me.

    This post is not guarantied to be correct, and is not to be taken as a matter of fact, but of opinion or a guess, unless otherwise noted.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  2. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  3. How to program in unix
    By Cpro in forum Linux Programming
    Replies: 21
    Last Post: 02-12-2008, 09:54 AM
  4. Problems about gcc installation
    By kevin_cat in forum Linux Programming
    Replies: 4
    Last Post: 08-09-2005, 09:05 AM
  5. command in unix for checking memory leaks
    By sanju in forum Linux Programming
    Replies: 1
    Last Post: 01-22-2003, 05:51 AM

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