Data sending problem
Data sending problem
- Subject: Data sending problem
- From: Ben Bird <email@hidden>
- Date: Fri, 12 Sep 2008 10:45:32 +0100
Hi All,
I have written a web server using BSD sockets and the CFSocket API -
similar to the CFLocalServer example code from Apple. It is all
working very well apart from one problem. If I have connection1
sending a continuous stream of data (a big file), and then the web
browser (Safari in this case) opens a second connection to download a
smaller file, my app will send all the data for connection2 (using the
write() system call to the bsd socket), but the client will not
receive the last few KB of that data. Safari will sit with the
download progress bar almost at the end waiting for the last bit of
the file. This last few KB is received only when connection2 is
closed, OR when connection1 is closed. So there is some strange
interaction between the streams. It's as though the data is getting
stuck in a buffer somewhere on the server. This problem does not occur
when there is only one connection sending a file - in this case all
the data is received as soon as it is sent; it's only when there is
another connection sending data at the same time that the problem
occurs. These are keep-alive connections, so the server will send the
file on the connection and then leave the connection open waiting for
the next HTTP request. Is there any way to flush the stream so that
whatever data given to write() is actually sent over the socket?
Any help or suggestions will be much appreciated!
Thanks,
Ben
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden