?
=?ISO-8859-15?Q?Bastian_P=F6ttner?=
Hey guys,
I am currently trying my best to implement a simple TCP Server in c++.
It waits for connections of clients and sends out files on request.
I made the socket non blocking since I want to do other stuff while no
data is being sent.
My problem is: Whenever I transfer a larger amount of data, the send
call returns a length that is smaller than I wanted to send. I suspect
that this is because of the TCP send buffer which might have run out of
space.
My question is: How can I avoid sending incomplete "messages" using TCP?
Is there any way to determine the space left in the send buffer? Or
should I switch to blocking operation? How would I use select to figure
out if data is available for reading?
Thanks for your help,
Bastian
I am currently trying my best to implement a simple TCP Server in c++.
It waits for connections of clients and sends out files on request.
I made the socket non blocking since I want to do other stuff while no
data is being sent.
My problem is: Whenever I transfer a larger amount of data, the send
call returns a length that is smaller than I wanted to send. I suspect
that this is because of the TCP send buffer which might have run out of
space.
My question is: How can I avoid sending incomplete "messages" using TCP?
Is there any way to determine the space left in the send buffer? Or
should I switch to blocking operation? How would I use select to figure
out if data is available for reading?
Thanks for your help,
Bastian