Hi,
I did some time measure on tcp. I used SO_LINGER.
linger lingervalue;
lingervalue.l_onoff=1;
lingervalue.l_linger=32767;
setsockopt(mySocket,SOL_SOCKET,SO_LINGER,(char*)&l ingerwert,sizeof(lingerwert));
then I did:
typedef long long s64;
inline s64 getRealTime() {
s64 result;
__asm__ __volatile__ ("rdtsc" : "=A" (result));
return result;
}
s64 start64, end64;
tcpSender testSender2=tcpSender(argv[1],line,length);
testSender2.init(option); //socket,SO_LINGER, bind and connect
start64=getRealTime();
testSender2.work(); //send data
do
closeid=testSender2.end();//close socket
while(closeid<0);
end64 = getRealTime();
I used a 100MBit Ethernet, sitched and Red Hat Linux 9. I did this 10
times and used the middle of the values
I have these problems:
* sending 80000 bytes (17ms) is faster than sending 10240 bytes (40ms)
* sending 800000 bytes is faster then the network (fastest value:2 ms
but it can't be faster then 64 ms)
What did I wrong? SO_LINGER wait til the queue has been send sucessfully.
Any idea is good. I go nuts over this.
Thanks
Stephan
|