CodePudding user response:
7 0.5 MB/s=14 MB/s=112 mbit/sMB network can't satisfy the,
CodePudding user response:
Here is gigabit networkCodePudding user response:
Simple, under the condition of network conditions, if you just for this one condition (500 ms receiving 7 MB bytes), then you just need to do the following:
Char * buf=NULL;
Int index=0, pkt_len=8 * 1024 * 1024;
//omit pointer check
Buf=new char [pkt_len];
Memset (buf, 0, pkt_len);
While (TRUE)
{
Int len=recv (buf + index, pkt_len - index);//a simplified API, just to illustrate the process
Index +=len;
If (index & gt;=x)//x for you or the packet length obtained by agreement head
{
//do anything
//you can do here protocol processing, can also be transferred to another buffer by the worker to do deal with
}
}
Scenario established by the above steps completely meet your requirements
CodePudding user response:
Don't need to be in a special setting.You only need to use TCP, send, all while receiving.
Big data sent in a little at a time, such as a send 1 m.
Then, it is best not to have a disk IO operations, because this will be slow.
We have gigabit net, receives the speed up to 125 MB/s has been basically reached gigabit limit.
But some of the computer, because of the network card or the CPU, can not reach. So high, but 30 MB/s - 50 m/s general computer can achieve.
You just 14 MB/s, no problem at all.
CodePudding user response:
Actual use process, read the string data, the test can only read about 8000 of the length of the string, the need to adopt circulating reading way to read, in the long run this way there will be a certain a pack of couldn't read, don't know this kind of site you ever met a great god,CodePudding user response:
Is now the application reads the amount of data that is to put a set to 8000 byte, read cycle, until all the 7 m data read, but after running more than a hour, can appear the phenomenon of network failed to get the data received, don't know how to solve,CodePudding user response: