473,769 Members | 7,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

remoting general marshal

Tom
I think I'm still a little rough on the principle and understanding of
Marshal by value and Marshal by reference after reading various materials.

my understanding of Marshal by value is that the object is copied and passed
by value out of the application domain. So does that mean the ENTIRE server
object is copied to the client side ? thus all calculations are done on the
client side ?

ie. if client/server

if server has add(int x, int y)

and client calls on server add(5,6)

by Marshal by value does that mean the ENTIRE object of add is copied and
process of 5 + 6 is performed on the client ? is that what it means ?

but then again my understanding of an OBJECT is simply a reference to a
class or method. so copying an object is merely copying a method's reference
so what is the difference between Marshal by value and Marshal by reference
?
Thanks guys, I have read many books but still can't grasp it.

Tom
Nov 16 '05 #1
3 1941
Tom,

See inline:
my understanding of Marshal by value is that the object is copied and
passed
by value out of the application domain. So does that mean the ENTIRE
server
object is copied to the client side ? thus all calculations are done on
the
client side ?

ie. if client/server

if server has add(int x, int y)

and client calls on server add(5,6)

by Marshal by value does that mean the ENTIRE object of add is copied and
process of 5 + 6 is performed on the client ? is that what it means ?
The concept of whether or not something is passed by reference or by
value (as it relates to remoting) applies to a type when it is used as a
parameter to a call that occurs outside of the current app domain. In this
case, you determine whether or not 5 and 6 are passed by value or by
reference to the other app domain. Because they are of type Int32, and that
does not derive from MarshalByRefObj ect, it will be passed by value. This
means that the values of 5 and 6 will be copied over to the new application
domain, and any changes made to them are not going to be seen by you.

Now, if the signature looked like this:

DoSomething(Sys tem.Windows.For ms.Control control)

And you passed a textbox, then the TextBox would not be copied. Rather,
a reference to it would be passed to the new application domain. Any calls
made to the control parameter in the other application domain would be
remoted back to the connecting client.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m


but then again my understanding of an OBJECT is simply a reference to a
class or method. so copying an object is merely copying a method's
reference
so what is the difference between Marshal by value and Marshal by
reference
?
Thanks guys, I have read many books but still can't grasp it.

Tom

Nov 16 '05 #2
Hi Tom,
my understanding of Marshal by value is that the object is copied and
passed
by value out of the application domain.
Copy and paste implies that the clipboard is involved. The clipboard is not
involved the object is serialized (its data part of course) whether in a
binary stream or in some text format (SOAP) send thru some channel to the
client and deserialized on the cliend side in the client's environment. From
this point on the obejct lives and works on the client machine.
So does that mean the ENTIRE server
object is copied to the client side ? thus all calculations are done on
the
client side ?
Entire server or whatever object is used. It is possible that the server is
not one monolithic object. it might use couple of helper objects that can be
serialized by value and perform some operation on the client side. The core
of the server on the other side might be (and usually is) marchaled by ref
and lives on the server machine.
if server has add(int x, int y)

and client calls on server add(5,6)

by Marshal by value does that mean the ENTIRE object of add is copied and
process of 5 + 6 is performed on the client ? is that what it means ?
No, the process of marchaling (serialization/deserialization ) of the object
that declares this method is done when you request that object rather than
when you call its methods. I'd say 'request the object' because if you
careate the object with *new* operator it is not different than creation of
any other local object. Marshaling occures when you get that object as
return value or form property of the marshaled by ref object on the server.
See marchaled by value means that the object has nothing special beside that
it is serializable.

but then again my understanding of an OBJECT is simply a reference to a
class or method. so copying an object is merely copying a method's
reference
so what is the difference between Marshal by value and Marshal by
reference
?


Marshal by ref means that one the server and cliend sides proxy objects are
created. Those proxies are in charge of treansfer the method calls between
them via some medium and hide the fact form the client that actually the
real logic and data are on other machine(or process or whatever). What the
client actually works with is a proxy object. That's why when you marchal by
ref only methods can be called (or properties, which are methods after all).
Marchal by value on the other hand means that state of the object (data ) is
packed and send to the client. Then the client creates a new object and
initilizes it with that data. So it gets copy of the object on its side.
This is totally new object and has nothing to do with its original on the
server.

This is most likely ref and value objects when remoting is not involved. You
know that when you copy reference to a ref object only the reference is copy
(the address so to speak). The object in the heap is only one. When you
copy value objects (like Int32 for example) you get new copy and from this
point on both objects has nothing to do with each other and they live
separate lives.
--
HTH
Stoitcho Goutsev (100) [C# MVP]

Nov 16 '05 #3
Tom
ahh thankyou now I understand
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:OH******** ******@TK2MSFTN GP12.phx.gbl...
Tom,

See inline:
my understanding of Marshal by value is that the object is copied and
passed
by value out of the application domain. So does that mean the ENTIRE
server
object is copied to the client side ? thus all calculations are done on
the
client side ?

ie. if client/server

if server has add(int x, int y)

and client calls on server add(5,6)

by Marshal by value does that mean the ENTIRE object of add is copied and process of 5 + 6 is performed on the client ? is that what it means ?
The concept of whether or not something is passed by reference or by
value (as it relates to remoting) applies to a type when it is used as a
parameter to a call that occurs outside of the current app domain. In

this case, you determine whether or not 5 and 6 are passed by value or by
reference to the other app domain. Because they are of type Int32, and that does not derive from MarshalByRefObj ect, it will be passed by value. This
means that the values of 5 and 6 will be copied over to the new application domain, and any changes made to them are not going to be seen by you.

Now, if the signature looked like this:

DoSomething(Sys tem.Windows.For ms.Control control)

And you passed a textbox, then the TextBox would not be copied. Rather, a reference to it would be passed to the new application domain. Any calls made to the control parameter in the other application domain would be
remoted back to the connecting client.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m


but then again my understanding of an OBJECT is simply a reference to a
class or method. so copying an object is merely copying a method's
reference
so what is the difference between Marshal by value and Marshal by
reference
?
Thanks guys, I have read many books but still can't grasp it.

Tom


Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2800
by: Catherine Jones | last post by:
Hi all, we need urgent help in a matter. We are trying to pass a COM object from the client to server and are facing some problems in the same. We've our client in C# as well as the Server in C# and we're using remoting for client to server communication.
5
306
by: Mark Broadbent | last post by:
Could someone clear this up for me a bit. I am a little bit uncertain about this but this is my understanding. Please correct where wrong or bits missing. There are two types of remoting :- Marshal-by-reference Server Activated objects (SAO). Object instanciated on the server. Default constructor. Creation delayed till first method call. Lifetime controlled by server
2
1200
by: Mark Broadbent | last post by:
Could someone clear this up for me a bit. I am a little bit uncertain about this but this is my understanding. Please correct where wrong or bits missing. There are two types of remoting :- <Marshal-by-reference> <SAO Properties = "Object instanciated on the server. Default constructor. Creation delayed till first method call. Lifetime controlled by server">
5
3973
by: Mark | last post by:
What I want to do is call a function in my main form/class from the server (which the another program/client calls). The main form does not really create a server object so I can't pass the frmForm class into the constructor of MyServer (the client side would have no idea what to pass into that anyways). What other way to do this is there? I guess there is static functions, but I can't make everything in those functions static. ...
15
5753
by: Sharon | last post by:
I’m trying to build a generic Publisher-Subscriber that will work over the net, so I’m using the Remoting. I wish that the subscriber user will be notify about the messages sent by the remote publisher, so I used delegate that the user will be able to set on it his own function for that purpuse. The trouble is that this delegate must not be static because there may be many subscribers, and each subscriber may have different...
4
2265
by: Sharon | last post by:
Hi, I'm using the remoting, and I have a remoting object that has a public event that other processes should register to it. But when the client process is registering to the remote event, it throw the following exception: System.Runtime.Serialization.SerializationException {“Cannot find the assembly Tester, Version=1.0.2164.27180, Culture=neutral, PublicKeyToken=null.”}
2
10651
by: Sagaert Johan | last post by:
Hi When the remoting server starts and the client immediate begins calling the remote object on the server no problems. But when the client does not need to access the remote object for some time the connection seems to be broken on the next attempt to do a call to the remote object on the server. (i need to restart the server application to get it working again ). So it appears if the remoting connection is idle for some time (...
4
6650
by: Rich | last post by:
Can anyone suggest a good (current) tutorial on how to do basic remoting with C# (2005 express edition)?
1
2844
by: Jeff | last post by:
..NET 2.0 Is generic lists faster then tradional lists when sending over a collection of objects (value by reference) in .NET remoting. Lets say if a list of object should be sent from a server to the client. Whould it be better to use generic lists? Jeff
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3963
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.