An exception is Remoting Exception - Authentication Failure. A detailed message says: "Unable to read data from transport connection: connection was closed."
I am having problems creating two simple servers that can communicate as remote objects in C #. ServerInfo is just the class that I created that contains IP and port and can return an address. It works great since I used it before and I debugged it. Also, the server starts just fine, no exception is thrown, and the channel is registered without problems. I use Forms to execute interfaces and call some of the methods on the server, but I did not find any problems with passing parameters from FormsApplication to the server during debugging. In this chapter, everything seems beautiful.
public ChordServerProgram() { RemotingServices.Marshal(this, "PADIBook"); nodeInt = 0; } public void startServer() { try { serverChannel = new TcpChannel(serverInfo.Port); ChannelServices.RegisterChannel(serverChannel, true); } catch (Exception e) { Console.WriteLine(e.ToString()); } }
I run two instances of this program. Then startNode is called in one of the application instances. The port is in order, the generated address is also beautiful. As you can see, I am using IP for localhost, as this server is for testing only.
public void startNode(String portStr) { IPAddress address = IPAddress.Parse("127.0.0.1"); Int32 port = Int32.Parse(portStr); serverInfo = new ServerInfo(address, port); startServer();
Then, in another case, through the interface again, I call another startNode method, providing it with a start server for information. Everything is going wrong here. When he calls the method on the seedServer proxy, he just got a RemotingException due to an authentication failure. (The parameter I want to get is node, I just use int to make sure the ChordNode class has nothing to do with this error.)
public void startNode(String portStr, String seedStr) { IPAddress address = IPAddress.Parse("127.0.0.1"); Int32 port = Int32.Parse(portStr); serverInfo = new ServerInfo(address, port); IPAddress addressSeed = IPAddress.Parse("127.0.0.1"); Int32 portSeed = Int32.Parse(seedStr); ServerInfo seedInfo = new ServerInfo(addressSeed, portSeed); startServer(); ChordServerProgram seedServer = (ChordServerProgram)Activator.GetObject(typeof(ChordServerProgram), seedInfo.GetFullAddress());