Click here to Skip to main content
15,925,181 members
Home / Discussions / C#
   

C#

 
GeneralGDI+ probs Pin
Confuzler6-Apr-05 2:37
Confuzler6-Apr-05 2:37 
GeneralRe: GDI+ probs Pin
leppie6-Apr-05 2:51
leppie6-Apr-05 2:51 
GeneralRe: GDI+ probs Pin
Confuzler6-Apr-05 3:12
Confuzler6-Apr-05 3:12 
GeneralRe: GDI+ probs Pin
Confuzler6-Apr-05 3:27
Confuzler6-Apr-05 3:27 
GeneralRe: GDI+ probs Pin
Confuzler6-Apr-05 4:57
Confuzler6-Apr-05 4:57 
GeneralAdd Image icon in textbox Pin
Adnan Siddiqi6-Apr-05 2:21
Adnan Siddiqi6-Apr-05 2:21 
GeneralRe: Add Image icon in textbox Pin
leppie6-Apr-05 2:45
leppie6-Apr-05 2:45 
GeneralDelegate on a MarshalByRefObject Pin
PEK6-Apr-05 1:17
PEK6-Apr-05 1:17 
I have created an service that communicate with clients via sockets. Now I need some kind of interface to the service so I could close all sockets, get information about the clients and so on.

My idea is to use an singleton object on the server which the (interface-) clients connects to. If a client want to close all sockets it calls a function on the object, and the object then calls a function in the server object which handles all sockets.

But I'm having problem with the communication between the singleton object and the server object. I'm trying to delegate a function on the server object to the client object.

This is the remote object:

public class RemoteObject : MarshalByRefObject 
{
	public delegate bool CloseSocketsDelegate();
	public CloseSocketsDelegate CloseSockets=null;		
}


And this is the server object:
public Server()
{
	ChannelServices.RegisterChannel( new TcpChannel(5050) );
	string url = "tcp://localhost:5050/RemoteObject";
		
	Type serverType = typeof(RemoteObject);
	RemotingConfiguration.RegisterWellKnownServiceType(
		typeof(RemoteObject), "RemoteObject", 
		WellKnownObjectMode.Singleton);

	RemoteObject rem = (RemoteObject)Activator.GetObject(serverType,url);
	
	/* Next line throws an security exception:
	 * 
	 * "System.Security.SecurityException: Type System.DelegateSerializationHolder
	 * and the types derived from it (such as System.DelegateSerializationHolder)  
	 * are not permitted to be deserialized at this security level."
	*/
	rem.CloseSockets = new RemoteObject.CloseSocketsDelegate( this.CloseSockets );
}

How do I solve the security exception? Is there some better way to solve the problem?
GeneralRe: Delegate on a MarshalByRefObject Pin
S. Senthil Kumar6-Apr-05 1:27
S. Senthil Kumar6-Apr-05 1:27 
GeneralRe: Delegate on a MarshalByRefObject Pin
PEK6-Apr-05 5:03
PEK6-Apr-05 5:03 
GeneralRe: Delegate on a MarshalByRefObject Pin
Tom Larsen6-Apr-05 4:45
Tom Larsen6-Apr-05 4:45 
GeneralRe: Delegate on a MarshalByRefObject Pin
PEK6-Apr-05 5:59
PEK6-Apr-05 5:59 
GeneralRe: Delegate on a MarshalByRefObject Pin
Tom Larsen11-Apr-05 6:47
Tom Larsen11-Apr-05 6:47 
GeneralRe: Delegate on a MarshalByRefObject Pin
S. Senthil Kumar6-Apr-05 20:04
S. Senthil Kumar6-Apr-05 20:04 
GeneralRe: Delegate on a MarshalByRefObject Pin
Tom Larsen11-Apr-05 6:27
Tom Larsen11-Apr-05 6:27 
Questionhow to get screen solution number? Pin
MJay5-Apr-05 23:56
MJay5-Apr-05 23:56 
AnswerRe: how to get screen solution number? Pin
Ray Hayes6-Apr-05 0:12
Ray Hayes6-Apr-05 0:12 
Questionhow to use dll created by C,C++ in C# project? Pin
Sachin Gedam5-Apr-05 23:32
Sachin Gedam5-Apr-05 23:32 
AnswerRe: how to use dll created by C,C++ in C# project? Pin
spif20015-Apr-05 23:42
spif20015-Apr-05 23:42 
GeneralRe: how to use dll created by C,C++ in C# project? Pin
Sachin Gedam6-Apr-05 0:25
Sachin Gedam6-Apr-05 0:25 
GeneralRe: how to use dll created by C,C++ in C# project? Pin
DavidNohejl6-Apr-05 0:33
DavidNohejl6-Apr-05 0:33 
GeneralStarting a new thread -help Pin
Anthony Mushrow5-Apr-05 23:04
professionalAnthony Mushrow5-Apr-05 23:04 
GeneralRe: Starting a new thread -help Pin
spif20016-Apr-05 0:01
spif20016-Apr-05 0:01 
GeneralRe: Starting a new thread -help Pin
S. Senthil Kumar6-Apr-05 1:23
S. Senthil Kumar6-Apr-05 1:23 
GeneralRe: Starting a new thread -help Pin
Anthony Mushrow6-Apr-05 8:41
professionalAnthony Mushrow6-Apr-05 8:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.