locked
How to cancel data delay on TCP/IP network ? RRS feed

  • Question

  • I wrote audio data compression function and sending compressed audio data between two Windows7 computers.

    Audio data communication capacity has been reduced.  But the new issue is the time delay of audio data because of small compressed data.  The data is kept in buffer of TCP/IP and 10 to 20 seconds delay occurs after some minutes of communication.  Almost no delay when communucation is started.  But it becomes longer as communication continues with small sound.  Then I talk for one or some minutes , the deay time becomes short then it becomes almost nothing.

    I set following SO_RCVBUF and TCP_NODELAY measures for this deday.  But still delay occurs for 5 to 10 seconds or similar .  I think the buffer capacity of RWIN is not cancelled.
    How I cancel the delay ?

     int n,bufferSize=0;
     BOOL opt=true,bNoDelay=true;
     if (Socket(nSocketType, lEvent)){
      if(!SetSockOpt(SO_REUSEADDR, &opt, sizeof(BOOL),SOL_SOCKET)){
       n=GetLastError();
       m_miscF.DispSocketError(L"MyAsynchSocket:MyCreate:SetSockOpt SO_REUSEADDR",n);
      }
     if(!SetSockOpt(SO_RCVBUF, &bufferSize, sizeof(int),SOL_SOCKET)){
       n=GetLastError();
       m_miscF.DispSocketError(L"MyAsynchSocket:MyCreate:SetSockOpt SO_RCVBUF",n);
      }
      if(!SetSockOpt(TCP_NODELAY, &bNoDelay, sizeof(BOOL),IPPROTO_TCP)){
       n=GetLastError();
       m_miscF.DispSocketError(L"MyAsynchSocket:MyCreate:SetSockOpt TCP_NODELAY",n);
      }
      if (Bind(nSocketPort,lpszSocketAddress))   return TRUE;
      int nResult = GetLastError();
      Close();
      WSASetLastError(nResult);
     }
     return FALSE;

    Regards
    K.Okumura

    Tuesday, February 8, 2011 1:37 PM