[Mono-list] Remoting problem
RoBiK
robik@mailbox.sk
Wed, 11 Aug 2004 14:24:18 +0200
Hi,
could you please post the whole source for client and server?
I've made my own test and everything works fine here. I use .NET Famework
2.0 beta on a win2003 server to run the client part and FC2 with mono 1.0 as
server.
Here ist my source:
Client:
#region Using directives
using System;
using System.IO;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Activation;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
#endregion
namespace StreamSerializationTest
{
class Program
{
static void Main()
{
ChannelServices.RegisterChannel(new TcpChannel());
string date = DateTime.Now.ToString();
Console.WriteLine("Write: " + date);
object[] url = { new UrlAttribute("tcp://rre-fc2:1234") };
object[] args = { "test.txt", FileMode.Create };
StreamWriter sw = new
StreamWriter((FileStream)Activator.CreateInstance(typeof(FileStream), args,
url));
sw.WriteLine(date);
sw.Close();
args = new object[] { "test.txt", FileMode.Open };
StreamReader sr = new
StreamReader((FileStream)Activator.CreateInstance(typeof(FileStream), args,
url));
Console.WriteLine("Read: " + sr.ReadLine());
sr.Close();
Console.ReadLine();
}
}
}
Server:
using System;
using System.IO;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
class MainClass
{
public static void Main(string[] args)
{
ChannelServices.RegisterChannel(new TcpChannel(1234));
RemotingConfiguration.RegisterActivatedServiceType(typeof(FileStream));
Console.WriteLine("Press any key");
Console.ReadLine();
}
}
Robert
________________________________
From: mono-list-admin@lists.ximian.com
[mailto:mono-list-admin@lists.ximian.com] On Behalf Of Dan Cimpoiesu
Sent: Mittwoch, 11. August 2004 11:24
To: mono-list@lists.ximian.com
Subject: [Mono-list] Remoting problem
Hello there.
I have a client/server app that runs on Windows, and I must make the server
to run on Linux as well.
I choosed the Mono for start.
The problem is that if I have a remoting object that contains the following
method in the Remoting object
public Stream GetStream()
{
outputStream=(Stream)File.OpenWrite("Test.zip"); //outputStream is a
class member
return outputStream;
}
and I get a reference of this object on a client ( with Activator object )
and try to use the resulting Stream ( read/write or any other operation ),
the client application hangs.
This happens only when I run the server on Linux with Mono. On windows it
works ok.
Any suggestions?
Regards
Dan Cimpoiesu
________________________________
Cautam cinefili pentru premiere!
<http://www.videomax.ro/NewsLetter/Step1.asp>
Videomax.ro <http://www.videomax.ro/> pune la bataie 172 premii in valoare
de 117 milioane lei. Intra si tu in competitie!