Re: Remoting failing on second call
- From: Markus <difh04-gen1REMOVE@xxxxxxxxxxxx>
- Date: Wed, 13 Dec 2006 09:52:05 +0100
Saran,
I am doing some work outs on remoting to understand it. I have a remote server running on different machine. And i am trying to
execute the client on my machine. When i call the Message( ) method
on the remote object, it should send me a text across which i can
print on my console. Everything is happening fine at the first time.
The problem is not you remoting connection, but rather the file access
method (as it tries to open a file, that is already opened). So change
it to this (the easiest is to use the "using" keyword, then it is
ensured by the framework, that the file gets closed):
Object:
~~~~~
[...]
FileStream fs;
StreamReader sr;
string s = "",t;
using (fs = File.Open(@"C:\Message.Txt",FileMode.Open,FileAccess.Read,FileShare.None))
{
using (sr = new StreamReader(fs))
{
while (true)
{
t = sr.ReadLine();
if (!(t==null))
{
s += t;
}
else
{
break;
}
}
}
}
return s;
[...]
hth
Markus
.
- Follow-Ups:
- Re: Remoting failing on second call
- From: sxsrira
- Re: Remoting failing on second call
- References:
- Remoting failing on second call
- From: sxsrira
- Remoting failing on second call
- Prev by Date: Remoting failing on second call
- Next by Date: Re: Remoting...Because of security restrictions, the type System.Runtime.Remoting.ObjRef cannot be accessed.
- Previous by thread: Remoting failing on second call
- Next by thread: Re: Remoting failing on second call
- Index(es):
Loading