Remoting Error

T

TELOPHASE

Hello All,
I am working on a remoting project and i dont know why but the object
created on server side and client side are totally diffrent from each
other.
Even their hash codes are diffrent, which means that i am getting 2
totally diff obj instead of sharing 1 obj between client/server.
Please Help :-SS

Also, can the server application call methods of the shared Object??

The procedure on server side is as follows:-
class NetworkManager
{
public RemDeskBridge rdb;
public NetworkManager()
{

TcpChannel tc = new TcpChannel(9000);
ChannelServices.RegisterChannel(tc,false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof
(RemDeskBridge),

"RemDeskBridge.rem",WellKnownObjectMode.Singleton);
rdb = new RemDeskBridge();

}
}
---------------------------------
The procedure on client side is :-
public partial class Form1 : Form
{
RemDeskBridge rdb;
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

TcpChannel tc = new TcpChannel();
ChannelServices.RegisterChannel(tc,false);

rdb = (RemDeskBridge)
Activator.GetObject(typeof(RemDeskBridge),

"tcp://localhost:9000/RemDeskBridge.rem");
}
----------------------------------------------

Here's the shared class RemDeskBridge between them

public class RemDeskBridge : MarshalByRefObject
{
bool isConnected, isAuthenticated;
string user, pass;
Image img;
//Setter Methods
public void setUP(string u, string p)
{
user = u;
pass = p;
}
public void setConnected(bool val)
{
isConnected = val;
}
public void setAuthenticated(bool val)
{
isAuthenticated = val;
}
public void setImage(Image i)
{
img = i;
}
//Gettter Methods
public bool authenticate(string u, string p)
{
if ((u == user) && (p == pass))
return (true);
else
return (false);
}
public bool canConnect()
{
return (!(isConnected));
}
public Image getImage()
{
return (img);
}
}
 
D

Dmytro Lapshyn [MVP]

Hello All,

What's the actual type Activator.GetObject gives you? It should be something
to the tune of TransparentProxy or RealProxy (not sure which one exactly).
If it is the case, your Remoting scenario most likely works properly.
Also, can the server application call methods of the shared Object??

Not sure. Can you please ask in microsoft.public.dotnet.framework.remoting?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top