Thanks Ignacio, dmm and kevin for replying, makes me feel that theres hope
for this.. hehe Ive been working on these for 3 days now but still nothing.
Its definitely security problems and ive been changing the permissions to
fulltrust already, im not sure if im doing it wrong or it just doesn work. Im
using C# to make a DLL for my web application to use as an
object(ActiveX). Everything works fine until my dll starts to call the
tcplistener.Start(). It works fine when i test it as a console application
but when used as an activeX app in the web, it produces an SecurityException:
------------------------------------------------------------------------------
System.Security.SecurityException: Request for the permission of type
'System.Net.SocketPermission, System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed.
The action that failed was:
Demand
The type of the first permission that failed was:
System.Net.SocketPermission
The Zone of the assembly that failed was:
Intranet
---------------------------------------------------------------------------------
Heres the part of my code where it fails: (it works on console but doesnt on
activeX so i think nothings wrong with my code)
private void StartListen()
{
System.Windows.Forms.MessageBox.Show("StartListen");
while(_flagServer)
{
try
{
System.Windows.Forms.MessageBox.Show("while(_flagServer)");
Socket socket = _tcpListener.AcceptSocket();
socket.Blocking = true;
if(socket.Connected)
{
SocketProcessor processor = new SocketProcessor( socket );
processor.OnTerminate += new SocketProcessor.TerminateEventHandler(
this.OnTerminateHandler );
_processors.Add( processor );
Thread thread = new Thread( new ThreadStart( processor.Process ));
thread.Start();
}
}
catch (SocketException ex)
{
System.Windows.Forms.MessageBox.Show("SocketException: {0}", ex.ToString());
_flagServer = false;
break;
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("Exception: {0}", ex.ToString());
_flagServer = false;
break;
}
}
}