Remote

R

R Srinivasan

folks :

a) i am attempting to translate the following C# code into C++. the
compiler complains about System.Runtime.Remoting.Channels.Tcp saying Tcp is
not part of the Channels namespace. Is there something special I have to do?

b) Basically the reason i need to do this is to access some port level
routines. I am not sure I even want to attempt that from C#. (_inpb, _outpb
for example). Clues most welcome.



using System.Runtime.Remoting ;

using System.Runtime.Remoting.Channels ;

using System.Runtime.Remoting.Channels.Tcp ;

public class CoHello : MarshalByRefObject

{

public static void Main(string[] args)

{

Console.WriteLine("Hello World!");

TcpChannel channel = new TcpChannel(4000) ;

ChannelServices.RegisterChannel(channel) ;

RemotingConfiguration.RegisterWellKnownServiceType(

typeof(CoHello) ,

"HelloDotNet" ,

WellKnownObjectMode.Singleton ) ;

System.Console.WriteLine("Hit <enter> to exit...");

System.Console.ReadLine() ;

}

public void SayHello()

{

Console.WriteLine("Hello Called");

}

}
 
R

Ronald Laeremans [MSFT]

Why don't you show the translated code and the actual compiler error.

I take it you have both:

#using <System.Runtime.Remoting.dll>
using namespace System::Runtime::Remoting::Channels::Tcp

Ronald Laeremans
Visual C++ team
 
R

R. Srinivasan

aha. i dont. that may well be it. i will try that when i get back to work.
thanks a bunch.

i did not have the #using for Remoting.dll

Ronald Laeremans said:
Why don't you show the translated code and the actual compiler error.

I take it you have both:

#using <System.Runtime.Remoting.dll>
using namespace System::Runtime::Remoting::Channels::Tcp

Ronald Laeremans
Visual C++ team

R Srinivasan said:
folks :

a) i am attempting to translate the following C# code into C++. the
compiler complains about System.Runtime.Remoting.Channels.Tcp saying Tcp is
not part of the Channels namespace. Is there something special I have to do?

b) Basically the reason i need to do this is to access some port level
routines. I am not sure I even want to attempt that from C#. (_inpb, _outpb
for example). Clues most welcome.



using System.Runtime.Remoting ;

using System.Runtime.Remoting.Channels ;

using System.Runtime.Remoting.Channels.Tcp ;

public class CoHello : MarshalByRefObject

{

public static void Main(string[] args)

{

Console.WriteLine("Hello World!");

TcpChannel channel = new TcpChannel(4000) ;

ChannelServices.RegisterChannel(channel) ;

RemotingConfiguration.RegisterWellKnownServiceType(

typeof(CoHello) ,

"HelloDotNet" ,

WellKnownObjectMode.Singleton ) ;

System.Console.WriteLine("Hit <enter> to exit...");

System.Console.ReadLine() ;

}

public void SayHello()

{

Console.WriteLine("Hello Called");

}

}
 
R

R Srinivasan

i solved this but cannot run the app.

with my C# app, i was able to simply copy the exec to a different machine
and was able to test the remoting function.

when i changed my server to C++, my client aborts saying "Unverified exe"
etc. etc. etc. leading me into a web of code signing etc.

i want to get to all that security eventually but right now, i am stuck just
plumbing a C++ server with a C# client!

any pointers to tutorials etc. would be great.

thanks

Ronald Laeremans said:
Why don't you show the translated code and the actual compiler error.

I take it you have both:

#using <System.Runtime.Remoting.dll>
using namespace System::Runtime::Remoting::Channels::Tcp

Ronald Laeremans
Visual C++ team

R Srinivasan said:
folks :

a) i am attempting to translate the following C# code into C++. the
compiler complains about System.Runtime.Remoting.Channels.Tcp saying Tcp is
not part of the Channels namespace. Is there something special I have to do?

b) Basically the reason i need to do this is to access some port level
routines. I am not sure I even want to attempt that from C#. (_inpb, _outpb
for example). Clues most welcome.



using System.Runtime.Remoting ;

using System.Runtime.Remoting.Channels ;

using System.Runtime.Remoting.Channels.Tcp ;

public class CoHello : MarshalByRefObject

{

public static void Main(string[] args)

{

Console.WriteLine("Hello World!");

TcpChannel channel = new TcpChannel(4000) ;

ChannelServices.RegisterChannel(channel) ;

RemotingConfiguration.RegisterWellKnownServiceType(

typeof(CoHello) ,

"HelloDotNet" ,

WellKnownObjectMode.Singleton ) ;

System.Console.WriteLine("Hit <enter> to exit...");

System.Console.ReadLine() ;

}

public void SayHello()

{

Console.WriteLine("Hello Called");

}

}
 
R

Ronald Laeremans [MSFT]

You need to grant permissions to the assembly or share to run unverifiable
code. There is a tool to do that in the administrative tools on every PC
where you installed the .Net runtime. Or you can use the command line
caspol.exe tool. There is lots of overview matarial on code access security
in the runtime to get you started.

Ronald

R Srinivasan said:
i solved this but cannot run the app.

with my C# app, i was able to simply copy the exec to a different machine
and was able to test the remoting function.

when i changed my server to C++, my client aborts saying "Unverified exe"
etc. etc. etc. leading me into a web of code signing etc.

i want to get to all that security eventually but right now, i am stuck just
plumbing a C++ server with a C# client!

any pointers to tutorials etc. would be great.

thanks

Ronald Laeremans said:
Why don't you show the translated code and the actual compiler error.

I take it you have both:

#using <System.Runtime.Remoting.dll>
using namespace System::Runtime::Remoting::Channels::Tcp

Ronald Laeremans
Visual C++ team

R Srinivasan said:
folks :

a) i am attempting to translate the following C# code into C++. the
compiler complains about System.Runtime.Remoting.Channels.Tcp saying
Tcp
is
not part of the Channels namespace. Is there something special I have
to
do?
b) Basically the reason i need to do this is to access some port level
routines. I am not sure I even want to attempt that from C#. (_inpb, _outpb
for example). Clues most welcome.



using System.Runtime.Remoting ;

using System.Runtime.Remoting.Channels ;

using System.Runtime.Remoting.Channels.Tcp ;

public class CoHello : MarshalByRefObject

{

public static void Main(string[] args)

{

Console.WriteLine("Hello World!");

TcpChannel channel = new TcpChannel(4000) ;

ChannelServices.RegisterChannel(channel) ;

RemotingConfiguration.RegisterWellKnownServiceType(

typeof(CoHello) ,

"HelloDotNet" ,

WellKnownObjectMode.Singleton ) ;

System.Console.WriteLine("Hit <enter> to exit...");

System.Console.ReadLine() ;

}

public void SayHello()

{

Console.WriteLine("Hello Called");

}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top