471,306 Members | 1,315 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,306 software developers and data experts.

Remoting Error


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);
}
}

Feb 8 '06 #1
1 1300
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?

"TELOPHASE" <te*******@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
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);
}
}

Feb 8 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by anders | last post: by
8 posts views Thread by Richard Bell | last post: by
15 posts views Thread by Ron L | last post: by
5 posts views Thread by LGHummel | last post: by
4 posts views Thread by Sharon | last post: by
reply views Thread by Kristian Reukauff | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.