Hi,
I have to make an ActiveX (Running on Internet Explorer) that
play/record sound from soundcard. Also, I have to create a Socket to
send/receive sound data to my server.
I use this tutorial to build my ActiveX :
http://samples.gotdotnet.com/quickst...eSourcing.aspx
When creating Socket object on client I got SecurityException. So I
resolved the problem by adding LocalIntranet_Zone (FullTrust) for my
server http://localhost/*.
Now I' m create the Socket object as :
_______________________________________________
// Get IP and port of remote host
IPEndPoint ep = new IPEndPoint(Dns.Resolve(m_IPAddress).AddressList[0],
m_PortNumber);
// Connect
m_ClientSocket.Connect(ep);
// Start received thread
Thread clientThread = new Thread(new ThreadStart(ReceiveThread));
clientThread.Name = "Client thread";
clientThread.Start();
// Back to ActiveX thread....
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Here is the Thread code :
________________________________________________
// Client is running
m_bIsRunning = true;
// Client is running
m_bIsThreadStopped = false;
// While client is running then read incomming data
while (m_bIsRunning)
{
// Start receive thread
try
{
byte[] buffer = new byte[this.m_ReceiveBufferSize];
int iBytesCount = this.m_ClientSocket.Receive(buffer, 0,
this.m_ReceiveBufferSize, SocketFlags.None); ;
if (iBytesCount == 0)
break;
// Raise data sent event
ClientDataReceivedEvent( new MemoryStream( buffer, 0,
iBytesCount ) );
}
catch (Exception ex)
{
if (m_bIsRunning)
ClientErrorOccuredEvent( ex );
break;
}
}
// Thread end
m_bIsRunning = false;
// Client disconnected
ClientDisconnectedEvent();
// Thread stopped
m_bIsThreadStopped = true;
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Now whatever I do the ActiveX is freezing Internet Explorer just when
this Thread is starting. What is the problem ?
Thanks for your help