Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

socket buffer size problem

Status
Not open for further replies.

slowman80

Programmer
Feb 5, 2003
2
SE
I am programming a client-server model and have the need to send large amount of data. The client connects to the server, then selects a file to be transfered (like an ftp program) and the server sends it.

The problem is that I cant seem to send packets larger then 7 kbytes.... The client crashes just after recieved 2 packets. I am using this code to create a socket:

sock = socket(PF_INET, SOCK_STREAM, 0);

I have also tried to increase the socket buffer with the following:

setsockopt(sock, SOL_SOCKET, SO_RCVBUF, &sock_buf, &sock_size);

sock_size is an integer currently set to 64000.

This is done with both the recieve and the send buffer on both the client and the server.

If anyone have any tips or suggestions please help me, anything at all is highly appreciated!!!!
 
I am not a sockets programmer, but a network admin.

Prior to Solaris 7 the TCP receive buffers defaulted to about 8k, now they default to 24k. (the send buffers correctly size themselves to the other machines receive buffers) You can add a script in /etc/rc3.d to increase the size

cat S95ndd
#!/bin/sh
# Set the TCP hiwater marks to 64K to improve SunSwift SBus
# Adapter performace. JJP 22-Aug-2000
case "$1" in
'start')
echo "Setting local kernel parameters...\c"
ndd -set /dev/tcp tcp_xmit_hiwat 65535
ndd -set /dev/tcp tcp_recv_hiwat 65535
ndd -set /dev/tcp tcp_cwnd_max 65534
echo ""
;;
'stop')
echo "No kernel parameters changed."
;;

*)
echo "Usage:$0 {start|stop}"
;;
esac
exit 0





The netstat command run before and after will show the change, hope this helps I tried to remain child-like, all I acheived was childish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top