×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    13

    Question Strange Socket Timing

    Hi,
    currently I'm doing some comparison in socket roundtrip timing on an uptodate N95 using WLAN with a simple socket connection and experiencing strange behaviour :/
    Small messages need much longer than bigger packets. Following times are avarage and standard deviation of 2000 runs:
    __100 Byte: 201 +- 26 ms
    _1000 Byte: 213 +- 44 ms
    _2000 Byte: 22 +- 18 ms
    10000 Byte: 55 +- 29 ms
    I repeated the tests, but the results keep the same!

    Please help me explaining...

    Here are some code fragments:
    Code:
    // SENDER 
    void CSocketCommunicator::ConstructL(){
    ...
    	iSendingBuffer = new (ELeave) TBuf8<TESTDATASIZE>;
    	for(int i=0; i<TESTDATASIZE; i++){
    		iSendingBuffer->Append(i%100);
    	}
    }
    
    ...
    	Send((TDesC8&)*iSendingBuffer);
    
    
    TInt CSocketCommunicator::Send(TDesC8& data){
    ...
    	iSocket.Write(data, iStatus);
    	User::WaitForRequest(iStatus);
    }
    
    // RECEIVER
    void SocketReceiver::ConstructL(){
    ...
    	iDataBuffer = new (ELeave) RBuf8();
    }
    
    void SocketReceiver::Receive(){
    	iStat = STAT_WAITING;
    	iSocket->Read (iHeaderBuffer, iStatus);
    	SetActive ();
    }
    
    void SocketReceiver::RunL()
    ...
    // length is read
    		iDataBuffer->ReAlloc(length);
    		//iDataBuffer->CreateL(length); 
    		iDataBuffer->FillZ(); 
    		iSocket->Read(*iDataBuffer, iStatus);
    ...
    }
    
    // TIME MEASUREMENT
    
    HAL::Get(HALData::EFastCounterFrequency, iTickPeriod);
    ...
    		iTime = User::FastCounter();
    		iSocketConnector->SendTest4();
    ...
    void CSocketClientAppUi::incomingMessage(TDesC8& header,TDesC8& data)
    	{
    	iTime = User::FastCounter ()-iTime;
    	iTime = iTime*1000/iTickPeriod;
    ...
    The server is a simple Java echo server listening on a static IP:Port.

    Thank you in advance,
    Charly

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: Strange Socket Timing

    I am no network expert, but as far as I know TCP can wait until some amount of data gets collected, and send in one step, that can cause a delay. You can find some magic values if you search for in_sock.h in the SDK Help. Since your step occurs between 1000 and 2000, I would guess that KSoTcpMaxSegSize is in action. Actually you can try what happens if you enable the next option which you will find in the SDK Help.

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    13

    Re: Strange Socket Timing

    Thank you, wizard_hu_!
    Adding
    Code:
    iSocket.SetOpt(KSoTcpNoDelay,KSolInetTcp,1);
    Send data at once if there is an established connection, without waiting for the maximum segment size to be reached.

    The default is disabled.
    accelerated sending of small messages significantly:
    100Bytes : 11 +- 33 ms

    Charly

Similar Threads

  1. Strange Problem on RFCOMM Socket
    By davmt in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2008-04-24, 07:00
  2. problem in persistant socket connection
    By poms4symbian in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2006-01-03, 13:23
  3. Socket problem
    By defragger in forum Symbian
    Replies: 0
    Last Post: 2005-08-25, 08:16
  4. S60(7650) strange problem with socket
    By filfob in forum Symbian
    Replies: 1
    Last Post: 2002-09-03, 04:45

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×