 |
|
 |
Thanks for this greatefull post
I am triying to use this sample to reproduce my own remoting need , the problem is how can i handle multiple event for server / client :
we can say as example to have tow listbox for chat and they are updated standalone ( not a the same event) ?
thanks.
|
|
|
|
 |
|
 |
this is what i am finding ...
|
|
|
|
 |
|
 |
I wonder when why I made an custom event arguments, I have to add the [Serilizable] Tag while the Marshalbyobjref remote object that is no needed. I tried if my event arguments is not tagged in serilizable, the program can still run without runtime or compile time error, but the only issue is the remote client cannot get any events, even with the wrapper event class.
And also, using the wrapper class in-between the remote object and remote client sounds non-sense to me somehow, as what I expected the remote proxy or whatever should handle these kinds of routine work for me, rather than making the codes repeating again and again (Whenever I have remote event, I have to write two lines to register the delegate instead of one), and the asynchrous call from the remote event to GUI elements, I have to make two handler to compeletely receive that event. The proxy is not transparent to the client code at all!
|
|
|
|
 |
|
 |
I tried hard to figure out how to get rid of those security issues in your problem solution 1. For days of searching in msdn and nothing good was found. Thanks.
|
|
|
|
 |
|
 |
Hi guys,
First off - awesome tutorial - I'm very new to this and trying to learn a bit more about it.
Sorry if this is a silly question, but I am trying to do this without the app.config files - partly because I like it all handled by code, and partly to force myself to learn this without magic files - and I'm running into some frustrating problems.
First, in the client form, I changed
RemotingConfiguration.Configure(Application.StartupPath + "\\Client.exe.config",false);
to
RemotingConfiguration.RegisterWellKnownClientType(typeof(Remotable.RemoteClass), "http://localhost:8080/Chat");
HttpChannel chan = new HttpChannel(0);
ChannelServices.RegisterChannel(chan, false);
After that, all was well - I could still test everything out, and multiple clients still would connect ok.
Then, on the server form, I changed
RemotingConfiguration.Configure(Application.StartupPath + "\\Server.exe.config",false);
to
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Remotable.RemoteClass), "Chat", WellKnownObjectMode.Singleton);
BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();
props["port"] = 8080;
HttpChannel chan = new HttpChannel(props, clientProv, serverProv);
ChannelServices.RegisterChannel(chan);
Now I am getting "System.ArgumentNullException: No message was deserialized prior to calling the DispatchChannelSink." followed by a stacktrace.
It happens in the "buttonSend_Click" method in the Client form. It compiles and opens fine, but when you hit the send button you get that error. Like I said, I'm not too familiar with this, but if you could help me out, or point me in the right direction I would be really grateful.
Thanks very much,
Alex
|
|
|
|
 |
|
 |
Alright, I found out the main problem - I am using sending everything using a Http channel, and then had tried to use Binary client and server FormatterSinkProviders.
Once i changed BinaryServerFormatterSinkProvider to SoapServerFormatterSinkProvider it started working ok.
But after I finish this, the reason I'm looking into this is actually to transfer some binary data - I was intending on using TCP channels to do that.
So... I changed all of the channels over to using TCP channels. And then I got a
"The server committed a protocol violation." error.
Well, I was in the middle of writing this out, asking for help again, when I remembered I hadn't changed my URI strings to TCP - they still read "http://localhost:6666/Chat"
So I changed them to "tcp://localhost:6666/Chat" and it works again, but I decided to finish off the message in case anyone else ran into that error.
|
|
|
|
 |
|
 |
-- Edit --
Eraghi -- I finally got all of this working in my own app for the first time. Thank-you so much for writing this article - I know it doesn't go over everything, but I've gone over a good handful of remoting articles in the last few days and none of them actually got me anywhere, or made it seem clearer for me - all I got was confused. This one was the one that finally 'clicked' it for me - I just wanted you to know that!
-- EndEdit --
Incidentally, I am trying to learn this to accomplish something specific.
I am sort of an amateur game designer. I'm working with XNA to make some fun stuff, but I want to try my hand at writing some cool tools to complement it.
Instead of just an exporter, I am trying to tie 3dStudio Max or Maya to my engine a bit more. I want to let the editor connect to a running game instance and update the position of entities, lights, and whatnot directly in the game. If that works I might go on to triggering events or sending scripted commands to the game also - but baby steps.
My intention was to write a .Net component that Max can spawn that will connect to the game and commandeer it.
So...this is one of the tutorials I'm looking at. If any of you guys have any insight on whether this is (or is definitely not!) a good way to go about achieving this I would really appreciate any input.
Thanks for any input!
Alex
modified on Monday, November 10, 2008 9:30 PM
|
|
|
|
 |
|
 |
Thanks for your nice article but I have a questuoin, how can I prevent broadcasting and specific client just notify when I use remoting and events?
Mazy
"This chancy chancy chancy world."
|
|
|
|
 |
|
 |
I'm not very knowledgeable in this sort of thing -- all I could really think of using remote events would be to store the client object reference when it subscribes to events, then check to see if it matches as the event checks through the invocation list.
It might not be that bad, since the code from the article has you go through the invocation list anyway to make sure there aren't any unresponsive clients each time the event is fired.
However...I don't know if the object of the invocation would get invalidated over time -- never done that before.
Alex
|
|
|
|
 |
|
 |
hello my friend
please help me about convert this project to VB.NET !
i have 2 problem too .
i can not speak english very well .
please help me
thanks
my mail : yavarifatemeh@yahoo.com
|
|
|
|
 |
|
 |
I have a Delegate Function on the server side that is used to launch a display screen on the UI that prompts the client for a selection which is in turn returned to calling method (server side).
I cannot get this to work using remoting however it does work standalone. The error message is the same as Problem 2 in the solution. But I am stuck trying to develop a wrapper solution.
I use SetDeleg to pass the UI screen address prior to processing
Public Delegate Function ConfigurationScreen(ByVal CategoryID As Integer, ByVal CategoryDescription As String, ByVal ItemID As Integer) As Integer
Dim confCallBack As ConfigurationScreen ' create the delegate object
Public Sub SetDeleg(ByVal retAddress As ConfigurationScreen)
confCallBack = retAddress ' forms return address
End Sub
I am using VB.net
Thanks for any help anyone can give me
|
|
|
|
 |
|
 |
Could any one help how to resolve my problem in remoting in VB.NET
I like to inform you that I’m in between beginner and moderate level. I’m developing a application in VB.NET using remoting concept for my academic purpose. I need replica of a object which is created in a server application to be accessed in other remote client machine…
Kindly help me as I’m nearing my dealine…
I’ll explain you briefly through a sample code…
First I’ll run this application and initialize the object…
Application 1(server):
Class file :
Class x
Public y as integer
…
…
End class
VB file:
Function init()
Dim ab as x
Ab.y=5
End function
After running the application 1, then I’m running the client machine.
Application 2(Remote Client):
VB file:
Dim obj as remoteobj
dim x as integer
x=obj.y
so that the value gets stored in the variable x.
Hariram
|
|
|
|
 |
|
 |
Dear Sirs,
Could you help how to resolve my problem in remoting in VB.NET
I like to inform you that I’m in between beginner and moderate level. I’m developing a application in VB.NET using remoting concept for my academic purpose. I need replica of a object which is created in a server application to be accessed in other remote client machine…
Kindly help me as I’m nearing my dealine…
I’ll explain you briefly through a sample code…
First I’ll run this application and initialize the object…
Application 1(server):
Class file :
Class x
Public y as integer
…
…
End class
VB file:
Function init()
Dim ab as x
Ab.y=5
End function
After running the application 1, then I’m running the client machine.
Application 2(Remote Client):
VB file:
Dim obj as remoteobj
dim x as integer
x=obj.y
so that the value gets stored in the variable x.
|
|
|
|
 |
|
 |
The shared class code is :
public delegate void MessageHandler(System::String^ message);
public ref class RemoteLibClass sealed : public MarshalByRefObject
{
public:
RemoteLibClass()
{
// add new client in to the collection
MessageSend::add(m_EventHandler);
};
~RemoteLibClass()
{
MessageSend::remove(m_EventHandler);
};
public: static event MessageHandler^ MessageSend{
static void add(MessageHandler^ handler)
{
m_EventHandler = dynamic_cast
(Delegate::Combine (m_EventHandler,handler));
}
static void remove(MessageHandler^ handler)
{
m_EventHandler = dynamic_cast
(Delegate::Remove (m_EventHandler,handler));
}
...
}
static void Fire_MessageSend(System::String^ strMsg)
{
if(m_EventHandler != nullptr)
{
MessageHandler^ MessageDelegate = nullptr;
cli::array^ invocationList_ = nullptr;
invocationList_ = m_EventHandler->GetInvocationList();
for each ( System::Delegate^ del in invocationList_)
{
MessageDelegate = (MessageHandler^)del;
MessageDelegate(strMsg);
}
}
}
Now any new client invocation will add or combine a new eventhandler therefore it will behave as multicastdelegate. The invocationlist must have delegate doubly linked list with this new client handler. But i am not getting any data in the invocationlist about previous client handler. Probably i need to create client some other way or shared class need to do some other checks for it.
The client code on form load:
System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e)
{
// configure remote connection
System::Runtime::Remoting::RemotingConfiguration::Configure( Application::StartupPath + "\\chatclient.exe.config", false);
//create a proxy from remote object
remoteObj = (RemoteLib::RemoteLibClass^)System::Activator::GetObject(RemoteLib::RemoteLibClass::typeid, "tcp://jitendra-v:9090/chat");
//create an instance of wrapper class
wrapperObj = gcnew RemoteLib::RemoteWrapperClass();
//Associate remote object event with wrapper method
remoteObj->MessageSend += gcnew RemoteLib::MessageHandler(&RemoteLib::RemoteWrapperClass::WrapperMessageReceivedHandler);
//Associate wrapper event with current form event handler
wrapperObj->WrapperMessageReceived += gcnew RemoteLib::MessageHandler(this, &ChatClient::Form1::MessageReceivedHandler);
}
Then on send button click i am firing the event :
// fire the event
remoteObj->Fire_MessageSend(this->SendMsg->Text);
Any managed C++ guru, please help
Thanks,
Jverma
|
|
|
|
 |
|
 |
I've setup your Asynch code on a machine and it works great on that machine. However, if I copy the client code to another machine on the same network, and edit the url in the client's config to point to the ip address of the server machine, an error is thrown by the client (the target machine actively refused the connection). I've turned off firewalls on both machines, and I'm even able to telnet to the server's port from the client machine. Have you tried this example code across a network? Here's a copy of the client's config....
<!--You can replace localhost with your server ip address or host name-->
<formatter ref="soap" />
<formatter ref="soap" typeFilterLevel="Full" />
thanks for any help, I'm trying to learn from this source.
|
|
|
|
 |
|
 |
There is localhost reference inside the code itself.
|
|
|
|
 |
|
 |
I think that you are smart enough to customize it for yourself
eraghi
|
|
|
|
 |
|
 |
Thanks for your article, it is very helpful !!!
I got some different problem hope you might help me as you have already digged into it ...
I have implemented very simple remoting app in managed C++ using .NET 2005. The client is connecting to the server but when it try to access the assembly object, it fail to get it. The error reported is : An Unhandled exception of type 'System.Runtime.Remoting.RemotingException' occured in mscorlib.dll. Additional information: Requested service not found.
Also in .NET 2005 windows application when i tried to Reference Assembly there is no interface to perform it i.e. project->Add References... is not available anymore. Therefore i used #using code and change project property to point to the folder where it exists.
It sounds to me that at runtime client is not getting reference to load the assembly.
Please help ???
Thanks,
-- jverma
jverma
|
|
|
|
 |
|
 |
Finally, i have resolved the issue. Now the problem is:
InvocationList does not include other clients i.e. i can not send message from one client window to other. Only local message send is working.
It is easy to do in C# but in managed C++ not ...
Please help ???
Thanks,
|
|
|
|
 |
|
 |
how did u resolved the issue?
|
|
|
|
 |
|
 |
I have basically implemented this code in VB.net 2.0 and it mostly works fine but... When I run: remoteClass.MessageReceived += new MessageHandler(wrapperClass.WrapperMessageReceivedHandler); the VB equlivant: AddHandler remoteClass.MessageReceived , New MessageHandler(AddressOf wrapperClass.WrapperMessageReceivedHandler) ...on the client my remoteClass is reinitialized, that is the New() constructor is run and any member variables are reset. Shared/static member variables are still valid but the actual object itself seems to be reset. Is this problem related to VB? Or am I not adding the remote events correctly or something? Cheers
|
|
|
|
 |
|
 |
Aparently it depends on how you declare you server object.
It apprears that the New() constructor is run when you register the object. I was trying to run my own constructor with variables on it, which it doesn't like for some reason.
|
|
|
|
 |
|
 |
for example,a server has a fixed www ip address,but a client workstation is behind a router's back,and the router's www ip address is dynamic,what can i do for it in order to let the remoting event pass the router's NAT?
3ks
growing up and up
|
|
|
|
 |
|
 |
i have same problem with u.so how do u solve it?
if you don't mind...can you share that solution with me..i really appreciate it..tq
|
|
|
|
 |
|
 |
You need more smart protocol then supplyed TCP or HTTP.
|
|
|
|
 |