def nl_socket_set_buffer_size(sk, rxbuf, txbuf):
rxbuf = <NUM_LIT> if rxbuf <= <NUM_LIT:0> else rxbuf<EOL>txbuf = <NUM_LIT> if txbuf <= <NUM_LIT:0> else txbuf<EOL>if sk.s_fd == -<NUM_LIT:1>:<EOL><INDENT>return -NLE_BAD_SOCK<EOL><DEDENT>try:<EOL><INDENT>sk.socket_instance.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, txbuf)<EOL><DEDENT>except OSError as exc:<EOL><INDENT>return -nl_syserr2nlerr(exc.errno)<EOL><DEDENT>try:<EOL><INDENT>sk.socket_instance.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, rxbuf)<EOL><DEDENT>except OSError as exc:<EOL><INDENT>return -nl_syserr2nlerr(exc.errno)<EOL><DEDENT>sk.s_flags |= NL_SOCK_BUFSIZE_SET<EOL>return <NUM_LIT:0><EOL>
Set socket buffer size of Netlink socket.

    https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L675

    Sets the socket buffer size of a Netlink socket to the specified values `rxbuf` and `txbuf`. Providing a value of 0
    assumes a good default value.

    Positional arguments:
    sk -- Netlink socket (nl_sock class instance).
    rxbuf -- new receive socket buffer size in bytes (integer).
    txbuf -- new transmit socket buffer size in bytes (integer).

    Returns:
    0 on success or a negative error code.