Commit 8eb85966 authored by Anne Heimes's avatar Anne Heimes

not running -> disconnect ist unsauber

parent 1d03a0d7
......@@ -4,9 +4,9 @@
#include <VistaInterProcComm/Connections/VistaConnectionIP.h>
#include <VistaBase/VistaExceptionBase.h>
#include <VistaBase/VistaStreamUtils.h>
#include <cstring>
#include <algorithm>
#include <cstring>
#include <algorithm>
#include <cassert>
#include <iostream>
#include <iomanip>
......@@ -140,7 +140,7 @@ void CITANetAudioMessage::ReadMessage()
int iIncommingBytes = m_pConnection->WaitForIncomingData( 0 );
int iBytesReceived = m_pConnection->Receive( &m_vecIncomingBuffer[ iBytesReceivedTotal ], iIncommingBytes );
iBytesReceivedTotal += iBytesReceived;
#if NET_AUDIO_SHOW_TRAFFIC
#if NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "[ CITANetAudioMessage ] " << std::setw( 3 ) << std::floor( iBytesReceivedTotal / float( nMessagePayloadSize ) * 100.0f ) << "% transmitted" << std::endl;
#endif
}
......@@ -225,7 +225,7 @@ void CITANetAudioMessage::ReadAnswer()
int iIncommingBytes = m_pConnection->WaitForIncomingData( 0 );
int iBytesReceived = m_pConnection->Receive( &m_vecIncomingBuffer[ iBytesReceivedTotal ], iIncommingBytes );
iBytesReceivedTotal += iBytesReceived;
#if NET_AUDIO_SHOW_TRAFFIC
#if NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "[ CITANetAudioMessage ] " << std::setw( 3 ) << std::floor( iBytesReceivedTotal / float( nMessagePayloadSize ) * 100.0f ) << "% of answer transmitted" << std::endl;
#endif
}
......
......@@ -61,14 +61,19 @@ CITANetAudioStreamingClient::CITANetAudioStreamingClient( CITANetAudioStream* pP
CITANetAudioStreamingClient::~CITANetAudioStreamingClient()
{
if( m_pConnection )
{
m_pMessage->ResetMessage();
m_pMessage->SetConnection( m_pConnection );
m_pMessage->SetMessageType( CITANetAudioProtocol::NP_CLIENT_CLOSE );
m_pMessage->WriteMessage();
m_pClient->Disconnect();
}
//try{
if (m_pConnection->GetIsOpen())
{
m_pMessage->ResetMessage();
m_pMessage->SetConnection(m_pConnection);
m_pMessage->SetMessageType(CITANetAudioProtocol::NP_CLIENT_CLOSE);
//m_pMessage->WriteMessage();
m_pClient->Disconnect();
}
//}
//catch (ITAException e){
// std::cout << e << std::endl;
//}
delete m_pClientLogger;
}
......
......@@ -16,7 +16,7 @@ using namespace std;
int main(int argc, char* argv[])
{
//if (argc != 7)
if (argc != 7)
{
cout << "argc = " << argc << endl;
cout << "sServerName = " << argv[1] << endl;
......@@ -36,7 +36,7 @@ int main(int argc, char* argv[])
int iChannels = atoi(argv[5]);
int iBufferSize = atoi(argv[6]);
cout << "Channel" << iChannels << endl;
cout << "Channel " << iChannels << endl;
CITANetAudioStream oNetAudioStream(iChannels, dSampleRate, iBlockLength, 1 * iBufferSize);
......@@ -142,7 +142,6 @@ int main(int argc, char* argv[])
}
ITAsioFinalizeLibrary();
return 0;
}
......@@ -6,6 +6,7 @@
#include <ITAStreamFunctionGenerator.h>
#include <ITAStreamMultiplier1N.h>
#include <ITAFileDatasource.h>
#include <VistaBase\VistaTimeUtils.h>
using namespace std;
......@@ -31,8 +32,15 @@ int main(int argc, char** argv)
cout << "Starting net audio server and waiting for connections on '" << sServerName << "' on port " << iServerPort << endl;
oStreamingServer.Start( sServerName, iServerPort );
int iKey;
std::cin >> iKey;
while (!oStreamingServer.IsClientConnected())
{
VistaTimeUtils::Sleep(100);
}
while (oStreamingServer.IsClientConnected())
{
VistaTimeUtils::Sleep(100);
}
VistaTimeUtils::Sleep(1000);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment