f



SO_SNDBUF too bi?

Hi,

I'm trying to make a file transfer server that transfers files very fast. 
The problem is that for some reason it takes very long for the server to 
notice if the connection to the client is (fysically) down, mean while it 
keeps sending those packages until the tcp stacks send buf fills. Sometimes 
this might tak as long as 15 minutes. I have set the following: 


int MAX_TX_BUFFER = 4096;
f( setsockopt( sockfd, SOL_SOCKET, SO_SNDBUF, &MAX_TX_BUFFER, sizeof( int )) 
== -1)
  {
    perror("setsockopt");
    exit(1);
  }
 
Now I know if that if I tune the MAX_TX_BUFFER down the time (or actually 
the amount of packet sent) needed to notice that the network connection is 
down diminished. However since I'm trying to optimise the transfer speed 
and reliability to multiple connections tuning the MAX_TX_BUFFER size down 
isn't an option. Has anyone any clues?

I've also tried to set KEEPALIVE on but it seems linux doesn't send 
keepalives too often.


============================
problems with windows:  reboot,
   problems with unix: be root.
============================
0
Teemu
1/16/2004 8:26:34 AM
comp.os.linux.development.apps 5216 articles. 1 followers. Post Follow

1 Replies
3314 Views

Similar Articles

[PageSpeed] 27

Teemu wrote:
> Hi,
> 
> I'm trying to make a file transfer server that transfers files very fast. 
> The problem is that for some reason it takes very long for the server to 
> notice if the connection to the client is (fysically) down, mean while it 
> keeps sending those packages until the tcp stacks send buf fills. Sometimes 
> this might tak as long as 15 minutes. I have set the following: 
> 
> 
> int MAX_TX_BUFFER = 4096;
> f( setsockopt( sockfd, SOL_SOCKET, SO_SNDBUF, &MAX_TX_BUFFER, sizeof( int )) 
> == -1)
>   {
>     perror("setsockopt");
>     exit(1);
>   }
>  
> Now I know if that if I tune the MAX_TX_BUFFER down the time (or actually 
> the amount of packet sent) needed to notice that the network connection is 
> down diminished. However since I'm trying to optimise the transfer speed 
> and reliability to multiple connections tuning the MAX_TX_BUFFER size down 
> isn't an option. Has anyone any clues?
> 
> I've also tried to set KEEPALIVE on but it seems linux doesn't send 
> keepalives too often.
> 
> 
> ============================
> problems with windows:  reboot,
>    problems with unix: be root.
> ============================

Hello Teemu,

Here is an example that addresses timeout and blocking problem within 
sockets. This sample shows how to use fcntl(..) and select(..) and the 
SO_SNDTIMEO option.

  http://www.linuxcentral.com/linux/man-pages/getsockopt.2.html
  http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=select(2)

More about
  poll: wait for some event on a file descriptor (or socket descriptor).
  select, pselect: synchronous I/O multiplexing.

here
  http://www.linuxsa.org.au/mailing-list/1998-09/33.html

I hope the examples give you some ideas.
Share your solutions with us -;)

// os moma
    http://www.futuredesktop.org

   Currently !learning! and working with semaphores,
   shmem and pthread issues.
   Hopefully able do some sockets stuff very soon.


0
os
1/16/2004 2:57:55 PM
Reply: