Properties in Remoting
Posted
by Evl-ntnt
on Stack Overflow
See other posts from Stack Overflow
or by Evl-ntnt
Published on 2010-05-11T10:42:57Z
Indexed on
2010/05/11
10:44 UTC
Read the original article
Hit count: 313
Server:
Host h = new Host();
h.Name = "JARR!!";
TcpChannel channel = new TcpChannel(8080);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Host), "Server",
WellKnownObjectMode.Singleton);
Client:
TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
remoteHost = (Host)Activator.GetObject(typeof(Host),
"tcp://127.0.0.1:8080/Server");
Class:
[Serializable]
public class Host: MarshalByRefObject
{
public string Name{get; set;}
public Host(){}
public Host(string n)
{
Name = n;
}
public override string ToString()
{
return Name;
}
}
Connection OK, 8080 port opened, on client side remoteHost is not null, but remoteHost.Name == ""
Why?
© Stack Overflow or respective owner