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