473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

A question of remoting

when the client call a remote method,Whether the server will create a new
thread or not to complete the method?
My remote method will update the listView on the server,so I think if it is
performed in a new thread,then I should use listView's Invoke method,am I
right?
Thanks a lot!
Nov 15 '05 #1
5 1149
I'm not sure but you can check it by getting the current thread id when the app starts and getting it again in the method. If they
are different then you will need to call invoke.

--
Michael Culley
"Jeff Yang" <de*****@hotmail.com> wrote in message news:OV**************@TK2MSFTNGP09.phx.gbl...
when the client call a remote method,Whether the server will create a new
thread or not to complete the method?
My remote method will update the listView on the server,so I think if it is
performed in a new thread,then I should use listView's Invoke method,am I
right?
Thanks a lot!

Nov 15 '05 #2
Thanks!
I have tried.and in the debug window,I find the method is in a new
thread.So,it seems the server has created a new thread to complete the call.
then still another question:
I find in my method,there is such codes:
listView1.Items[chnum].SubItems[3].Text="hahaha";
then I can't use invoke,and how can i deal with it?

Thanks!

"Michael Culley" <mc*****@NOSPAMoptushome.com.au> дÈëÓʼþ
news:O8**************@tk2msftngp13.phx.gbl...
I'm not sure but you can check it by getting the current thread id when the app starts and getting it again in the method. If they are different then you will need to call invoke.

--
Michael Culley

Nov 15 '05 #3
Hi Jeff,

You can always check whether you need to Invoke() or not by checking the
listView's InvokeRequired property. As a rule, remoting requests are served
by threads on the thread pool, so you'll most likely need to use the
Control.Invoke mechanism.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Jeff Yang" <de*****@hotmail.com> wrote in message
news:OV**************@TK2MSFTNGP09.phx.gbl...
when the client call a remote method,Whether the server will create a new
thread or not to complete the method?
My remote method will update the listView on the server,so I think if it is performed in a new thread,then I should use listView's Invoke method,am I
right?
Thanks a lot!


Nov 15 '05 #4
Jeff,
I find in my method,there is such codes:
listView1.Items[chnum].SubItems[3].Text="hahaha";
then I can't use invoke,and how can i deal with it?
Actually, you can. Refactor your code a little bit to move all the
UI-related code to a separate private method (even if it would contain a
single line of code, that's OK). Define a delegate matching the method
signature (let's call it UiUpdateDelegate)

Then, replace the original code to the call to that private method that will
look like this:

if (!listView1.InvokeRequired)
{
DoUiUpdate(paramA, paramB);
}
else
{
listView1.Invoke(new UiUpdateDelegate(DoUiUpdate),
new object[] {paramA, paramB});
}
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Jeff Yang" <de*****@hotmail.com> wrote in message
news:O$**************@TK2MSFTNGP12.phx.gbl... Thanks!
I have tried.and in the debug window,I find the method is in a new
thread.So,it seems the server has created a new thread to complete the call. then still another question:
I find in my method,there is such codes:
listView1.Items[chnum].SubItems[3].Text="hahaha";
then I can't use invoke,and how can i deal with it?

Thanks!

"Michael Culley" <mc*****@NOSPAMoptushome.com.au> дÈëÓʼþ
news:O8**************@tk2msftngp13.phx.gbl...
I'm not sure but you can check it by getting the current thread id when

the app starts and getting it again in the method. If they
are different then you will need to call invoke.

--
Michael Culley



Nov 15 '05 #5
Thanks Dmitriy Lapshin!
Both of your answers really help a lot!
Now I think I can manage it with no doubt. :)

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> ????
news:uB**************@TK2MSFTNGP09.phx.gbl...
Hi Jeff,

You can always check whether you need to Invoke() or not by checking the
listView's InvokeRequired property. As a rule, remoting requests are served by threads on the thread pool, so you'll most likely need to use the
Control.Invoke mechanism.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Nov 15 '05 #6

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

Similar topics

0
by: Sean Newton | last post by:
I am absolutely bewildered by now by the Microsoft.Samples SSPI and Security assemblies. I've been trying to set these up in a very straightforward harness in the way that I'd like to be able to...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool This article makes a detailed comparison among SourceAnyWhere, SourceOffSite, VSS...
5
by: mayamorning123 | last post by:
A comparison among six VSS remote tools including SourceOffSite , SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET To view the full article, please visit...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere and VSS Remoting This article makes a detailed...
4
by: Uchiha Jax | last post by:
Hello everyone, I am a plenty silly person who is trying to learn .NET remoting through trial and error (all articles I read are going over my head at the moment (mostly) so I thought i'd give...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool This article makes a detailed comparison among SourceAnyWhere, SourceOffSite, VSS...
0
by: Martijn Damen | last post by:
Hi, At the moment I am trying to develop an application that uses another app over .net remoting and having some problems with it (ok, that is ofcourse why I am here), hope somebody can shine a...
8
by: Raju Joseph | last post by:
Hi All, I am just trying to get an opinion here. I know this is always a tough choice to make. We are in the process of converting our VB6 based Healthcare Information System (a full-fledged...
2
by: erbilkonuk | last post by:
Hi, I am very new to .NET Remoting and I try to run a simple program to subscribe to an event raised by Remoting Class. The Remoting Server initiates an instance of Remoting Class as Singleton /...
0
by: Kristian Reukauff | last post by:
Hi I have a problem with the .Net-Securty-Functions. I've got a client and a server. When I try to register a channel at the server with this line: ChannelServices.RegisterChannel(chan, false);...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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 project—planning, coding, testing,...
0
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...

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.