Results 1 to 10 of 10

Thread: problem with net remoting

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2003
    Posts
    89

    problem with net remoting

    hello, I have followed a tutorial on how to expose a class method over the net using net remoting.

    All is working fine. I have 2 apps, one acting as a server:
    Code:
    TcpChannel channel = new TcpChannel(12345);
    ChannelServices.RegisterChannel(channel);
    RemotingConfiguration.RegisterWellKnownServiceType( 
             typeof(myclass), 
             "mymethod", 
             WellKnownObjectMode.Singleton );
    and the other acting as a client:
    Code:
    TcpChannel chan = new TcpChannel();
    ChannelServices.RegisterChannel(chan);
    obj = (myclass) Activator.GetObject( 
             typeof(myclass),
             "tcp://localhost:12345/mymethod" );
    I then tried to combine this two snippets into a single chat application. I wanted to run two instances of it and let them both act as client and server at the same time.
    InstanceA calls mymethod on InstanceB
    InstanceB calls mymethod on InstanceA
    Unfortunately I get an error when I try to register the client channel after I registered the server channel. ie I get an error on the line in red:

    Code:
    TcpChannel channel = new TcpChannel(12345);
    ChannelServices.RegisterChannel(channel);
    RemotingConfiguration.RegisterWellKnownServiceType( 
             typeof(myclass), 
             "mymethod", 
             WellKnownObjectMode.Singleton );
    
    TcpChannel chan = new TcpChannel();
    ChannelServices.RegisterChannel(chan);
    obj = (myclass) Activator.GetObject( 
             typeof(myclass),
             "tcp://localhost:12345/mymethod" );
    what should I do? Is what I'm trying to do possibile in first place?
    I cannot provide the exception description because the debugger just says "Application has generated an exception that could not be handled".
    Many thanks in advance ^^
    Last edited by BrightSoul; Dec 22nd, 2005 at 10:10 AM.
    - mo! I said MOOOOOOO!!
    - ...yep, that's a cow, alright.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width