C# Programming
10-05-2009, 09:01 PM
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
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