If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
hi,
is there a way to determine how much socket buffer is used? i have a problem with a device showing me that its send buffer is full and i need to see if my app´s receive buffer might be too small. the amount of data sent by the device can vary during the app´s runtime, so i would like to change the size of the socket buffer when needed.
i change the socket buffer size using
Hi,
Why do you need to change the size of the buffer?
To answer you question: you can change the data/protocol setting the length of the packet as a first byte{s} and allocate appropriately.
ONEEYEMAN wrote:Why do you need to change the size of the buffer?
since the data rate could vary between 1000 and 480000 with 5 byte samples per second, i thought it would be great to change the size of the input buffer as needed.
so, is there no way to check how full my socket input buffer is?
Hi,
I don't think so.
Just send the size of the data as the first couple of bytes and check if the number of bytes you read is the same as the number of bytes in the beginning of the packet.
ONEEYEMAN wrote:
Just send the size of the data as the first couple of bytes and check if the number of bytes you read is the same as the number of bytes in the beginning of the packet.
I am not sure what you mean? I can only do things with my receive buffer, i cannot change what the device sends? I would like to check how much of my receive buffer is used.
the device is using tcp over ethernet.
maybe i am totally on the wrong track here, but if i want to check how much data has been received and waiting to be handled by my program, how can something in the transmission protocol be relevant?
thank you for your patience!
AFAIK there is no way to get this information. But i'm still not sure why you actually need it. In every data transmission, one of the two partners (sender/receiver) will be slower than the other. But the protocol should handle that, so that e.g. the sender stops sending until the receiver can receive again.
doublemax wrote:But the protocol should handle that, so that e.g. the sender stops sending until the receiver can receive again.
that is the thing, the device keeps on sending data plus messages that its buffer is 50% or 75% full. so i want to find the problem on the receiving end. if it is not the receiving buffer, then maybe cpu speed or my program or something else...
Is it actually fatal that the sending device says its send buffer is full? Or is it just a hint that it could send faster?
Do you do anything time consuming on the receiving end? If you can't process the data fast enough, all you can do is create a buffer as big as possible and hope that it's big enough to receive all data. If it's an endless stream of data and you can't process it fast enough, you're screwed