what is the problem in this >>> see the code and pls help me
-
remoting dll >>>> using System; using System.Collections; using System.Linq; using System.Text; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Http; namespace Remoting { public class ChatServer : MarshalByRefObject { ArrayList client = new ArrayList(); public void AddClient(string s) { client.Add(s); } public ArrayList AllClient() { return client; } } } Server code >>>>>>>> using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Http; using Remoting; namespace Server { public partial class Form1 : Form { ChatServer server; public Form1() { InitializeComponent(); HttpChannel ch = new HttpChannel(8080); ChannelServices.RegisterChannel(ch, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(ChatServer), "CS", WellKnownObjectMode.Singleton); } private void ShowClients_Click(object sender, EventArgs e) { server = new ChatServer(); ArrayList cn =server.AllClient(); foreach (string c in cn) { listBox1.Items.Add(c); } } } } client code >>>>> using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Http; using Remoting; namespace Client { public partial class Form1 : Form { ChatServer client; public Form1() { InitializeComponent(); HttpChannel ch = new HttpChannel(); ChannelServices.RegisterChannel(ch, false); RemotingConfiguration.RegisterWellKnownClientType(typeof(ChatServer), "http://localhost:8080/CS"); client = new ChatServer(); client.AddClient("AAA"); } } } >>>>>>>>> when i click on showclient its not showing ........ what is the problem. Thanks in Advance
-
remoting dll >>>> using System; using System.Collections; using System.Linq; using System.Text; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Http; namespace Remoting { public class ChatServer : MarshalByRefObject { ArrayList client = new ArrayList(); public void AddClient(string s) { client.Add(s); } public ArrayList AllClient() { return client; } } } Server code >>>>>>>> using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Http; using Remoting; namespace Server { public partial class Form1 : Form { ChatServer server; public Form1() { InitializeComponent(); HttpChannel ch = new HttpChannel(8080); ChannelServices.RegisterChannel(ch, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(ChatServer), "CS", WellKnownObjectMode.Singleton); } private void ShowClients_Click(object sender, EventArgs e) { server = new ChatServer(); ArrayList cn =server.AllClient(); foreach (string c in cn) { listBox1.Items.Add(c); } } } } client code >>>>> using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Http; using Remoting; namespace Client { public partial class Form1 : Form { ChatServer client; public Form1() { InitializeComponent(); HttpChannel ch = new HttpChannel(); ChannelServices.RegisterChannel(ch, false); RemotingConfiguration.RegisterWellKnownClientType(typeof(ChatServer), "http://localhost:8080/CS"); client = new ChatServer(); client.AddClient("AAA"); } } } >>>>>>>>> when i click on showclient its not showing ........ what is the problem. Thanks in Advance
Have you stepped through the code ? Why on earth are you using the ArrayList class ? It's obsolete.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Have you stepped through the code ? Why on earth are you using the ArrayList class ? It's obsolete.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
i am using arraylist to store all the clients name. i know its obsolete. well i can change it not a problem.... but what is the main problem why i am not getting the connected client when i am clicking on button showclient_click help me
Well, I don't know. I am just wondering if you can explain what you've done to help yourself, using the debugger,etc. If you can tell us what line of code isn't doing what you expect, it would help us to narrow it down, without having actually build your code and run a client/server to see what happens. Someone who has done more of this sort of work than me may come along and just answer it, but in the meantime, I think it's valuable to explore the things you should have mentioned in your original post, like what happens when you run it in the debugger.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Well, I don't know. I am just wondering if you can explain what you've done to help yourself, using the debugger,etc. If you can tell us what line of code isn't doing what you expect, it would help us to narrow it down, without having actually build your code and run a client/server to see what happens. Someone who has done more of this sort of work than me may come along and just answer it, but in the meantime, I think it's valuable to explore the things you should have mentioned in your original post, like what happens when you run it in the debugger.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
i have run debugger more then 5 times , but still not able to trace where is the problem....... its not showing any error.... but i am not getting the out put........ :(
Sir these what i have done 1. i made a dll remoting in which i had 2 methods AddClient and ALLClient 2. i made a server add reference of remoting.dll file and here i am calling the method allclient to view the clients connected to the server 3. i made a client add reference of remoting.dll file and here i am calling the method addclient. >>> anything wrong ?
-
i have run debugger more then 5 times , but still not able to trace where is the problem....... its not showing any error.... but i am not getting the out put........ :(
What makes you think that adding to the list in one program, will make it appear in the other one ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
What makes you think that adding to the list in one program, will make it appear in the other one ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
sorry sir. i am just trying this way. when a client starts the applicationand connects the server i am calling a method Addclient(Sys.Env.MachineName) . and then on the server i want the name of the clients connected to the server.............. what i have done was wrong? :( sorry :( help me out
-
sorry sir. i am just trying this way. when a client starts the applicationand connects the server i am calling a method Addclient(Sys.Env.MachineName) . and then on the server i want the name of the clients connected to the server.............. what i have done was wrong? :( sorry :( help me out
You have two instances of the same class type. They are on different machines. They are not the same instance, nor can they be. Therefore, passing the value to one, does not pass it to the other. At least, that's how it looks to me.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
You have two instances of the same class type. They are on different machines. They are not the same instance, nor can they be. Therefore, passing the value to one, does not pass it to the other. At least, that's how it looks to me.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.