PDA

View Full Version : Problem with receiving Data from TcpSocket



Basti300
15th July 2010, 14:41
Hello,

Well as my Topic already says i have a Problem with receiving all Data from a TcpSocket. Well let me first explain my project.
I have a AVR boad that runs a measurement software in linux. It receives commands from my Programm and then sends the measurement results. The Problem is that i dont receive all the data that is sent by the board.
I put my TcpSocket in a Thread (cant do it in another way as it is a task for my studies and my tutor wants the ethernet communication in a thread) and it all works fine with sending the data and commands to the board. Then the boards sends me the amount of data that it will send to me...so far all works...then i want to receive the measurement data but my my Programm only receives like 10-30 datasets but it should be 2000+....it stops receiving as soon as the server leaves its data_send function....so i guess my receive is to slow but i have no idea why that is.

this is the part of code where it gets stuck:


for (k = 0; k < measheader.anzchan; k++)
{
//receive data for each frequency, given by numfreqs
for (i = 0; i < measheader.numfreqs; i++)
{
iBlocks = 0;
while (iBlocks < (int) sizeof(specdata[i][k]))
{
if (new_sock.waitForReadyRead(30000))
{
iBytes = new_sock.read((char *)&specdata[i][k], sizeof(specdata[i][k]));

if (iBytes > 0)
{
iBlocks += iBytes;
}
}
}
}



Well i hope anyone can help me with that.

Basti