> 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)
> 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.
Here is an example that addresses timeout and blocking problem within
sockets. This sample shows how to use fcntl(..) and select(..) and the
poll: wait for some event on a file descriptor (or socket descriptor).
select, pselect: synchronous I/O multiplexing.
I hope the examples give you some ideas.
Share your solutions with us -;)
// os moma
Currently !learning! and working with semaphores,
shmem and pthread issues.
Hopefully able do some sockets stuff very soon.