0

I am making a remote desktop application. When I connect one client I can easy remoting but I cant connect more clients.

MyCode: Server

void start()
{
    try
    {

        URI = "Tcp://"+textBox1.Text+":6600/MyCaptureScreenServer";
        chan = new TcpChannel();
        ChannelServices.RegisterChannel(chan);
        obj = (ScreenCapture)Activator.GetObject(typeof(ScreenCapture), URI);

        connected = true;
        timer1.Enabled = true;
        textBox1.ReadOnly = true;

        this.FormBorderStyle = FormBorderStyle.None;// Full Size Mode
        this.WindowState = FormWindowState.Maximized;
        textBox1.Visible = false;
        menuItem5.Enabled = true;
    }
    catch (Exception) {
        stop();
    }
}

Client:

TcpChannel chan = new TcpChannel(6600);
ChannelServices.RegisterChannel(chan);
RemotingConfiguration.RegisterWellKnownServiceType(Type.GetType("ScreenCapture, ScreenCapture"), "MyCaptureScreenServer",WellKnownObjectMode.Singleton);
Rudi Visser
  • 21,350
  • 5
  • 71
  • 97
Star Gag
  • 1
  • 1

1 Answers1

0

I assume the second client is complaining that port 6600 is already in use?

A specific port number can only be registered once, this is generally done by one server component. This will also register the types for remoting. Multiple clients can then connect to the server.

nblackburn
  • 338
  • 2
  • 10
  • Yes, problem is with port. Can you please tell me how to change port for new connection – Star Gag Mar 11 '13 at 13:46
  • @StarGag We'd probably need more information on how you want it to work. Usually you would have 1 server that would register the port and remoting types. You seem to want multiple servers (which you call the client)? – nblackburn Mar 11 '13 at 14:36
  • I want one server. I want connect more clients on server. Now I can connect only one. – Star Gag Mar 11 '13 at 16:15
  • @StarGag The 'server' component should register the channel on a specific port number and call RegisterWellKnownServiceType. Then one to many clients can connect to it. In your example do you have server and client the wrong way round? Your client is registering the channel on a specific port number and calling RegisterWellKnownServiceType. – nblackburn Mar 11 '13 at 16:55