Re: udp sockets !!

Bob Felderman (feldy@myri.com)
Thu, 29 Oct 98 14:21:51 PST

=> From: Martin Koyabe <koyabe@erg.abdn.ac.uk>
=> Does someone out there know how I can increase the socket rate in =
=> Solaris 2.X ? I will really appreciate !! I have a tool that sends UPD =
=> packets from one machine to another and I am benchmarking the throughput =
=> gain over a 100Mbps FastEthernet link via 100Mbps Cisco-Switch !!

#! /bin/sh

# winsize 64 k (Make sure to include a space betw. 64 and k.)
# This changes the TCP window size to 64 KB from the default of 8K.

usage()
{
echo usage: winsize [size [k]]
exit
}

display()
{
/usr/ucb/echo -n "tcp_cwnd_max = "
/usr/sbin/ndd /dev/tcp tcp_cwnd_max
/usr/ucb/echo -n "tcp_xmit_hiwat = "
/usr/sbin/ndd /dev/tcp tcp_xmit_hiwat
/usr/ucb/echo -n "tcp_recv_hiwat = "
/usr/sbin/ndd /dev/tcp tcp_recv_hiwat

echo " "
/usr/ucb/echo -n "udp_recv_hiwat = "
/usr/sbin/ndd /dev/udp udp_recv_hiwat
/usr/ucb/echo -n "udp_max_buf = "
/usr/sbin/ndd /dev/udp udp_max_buf
}

modify()
{
if [ $tcp_win_size -lt 32768 ] ; then
tcp_cwnd_max=32768
elif [ $tcp_win_size -gt 65535 ] ; then
tcp_cwnd_max=`expr $tcp_win_size - 1`
else
tcp_cwnd_max=`expr $tcp_win_size`
fi
/usr/sbin/ndd -set /dev/tcp tcp_cwnd_max $tcp_cwnd_max
/usr/sbin/ndd -set /dev/tcp tcp_xmit_hiwat $tcp_win_size
/usr/sbin/ndd -set /dev/tcp tcp_recv_hiwat $tcp_win_size

/usr/sbin/ndd -set /dev/udp udp_recv_hiwat $tcp_win_size
/usr/sbin/ndd -set /dev/udp udp_max_buf 1048576
}

case $# in
0)
display;
;;
1)
tcp_win_size=$1
modify
display
;;
2)
if [ $2 != 'k' -a $2 != 'K' ]; then
usage;
fi
tcp_win_size=`expr $1 \* 1024`
modify
display
;;
*)
usage
;;
esac