Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Im having problem putting an idea into practice. The idea is that i am running a client server application. The client connects and sends data (obviously). The users are dealt with at the server side by a class called UserCollection which stores there info. I also wanted each client to send all the running processes to the server so that i can select a client and show all the running processes from that user. The problem lies in how to link clients to ProcessCollections (thats the class used to store all the process via System.Diagnostics.Process.GetProcesses()). How do I link in the class, the processes in an array to the clients.
 

Thanks,
Shmuli9
Posted 21-Nov-12 13:09pm
Shmuli9480
Comments
Sergey Alexandrovich Kryukov at 21-Nov-12 18:43pm
   
What is "send processes"? How a process can be sent?
--SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Not only for network application parts, but simply for a pair of different processes, the code and hence classes can be the same, but objects, class instances are always different. Processes are thoroughly isolated from each other. For communication, you need IPC. And when it comes to sending data encapsulated in classes, serialization is involved. An instance (but generally, a whole object graph of arbitrary topology) is serialized into an array of bytes, sent to another process and deserialized on the other end.
 
Please see:
http://en.wikipedia.org/wiki/Serialization#.NET_Framework[^],
http://msdn.microsoft.com/en-us/library/vstudio/aa349369%28v=vs.90%29.aspx[^].
 
One most advanced and easy-to-use method of serialization is Data Contract: http://msdn.microsoft.com/en-us/library/ms733127.aspx[^].
 
Please see also my past answers on Data Contract:
How can I utilize XML File streamwriter and reader in my form application?[^],
Creating property files...[^],
deseralize a json string array[^].
 
Serialization is already embedded in "classical" .NET remoting, and Data Contract — in WPF:
http://msdn.microsoft.com/en-us/library/kwdt6w2k%28v=vs.71%29.aspx[^],
http://msdn.microsoft.com/en-us/library/ms973857.aspx[^],
http://msdn.microsoft.com/en-us/library/vstudio/72x4h507%28v=vs.100%29.aspx[^],
http://msdn.microsoft.com/en-us/library/ms731190.aspx[^],
http://msdn.microsoft.com/en-us/library/ee354381.aspx[^],
http://msdn.microsoft.com/en-us/library/ms735103.aspx[^].
 
—SA
  Permalink  
Comments
Nelek at 22-Nov-12 17:06pm
   
OP's comment moved from non-solution below
Sorry if i wasnt clear.
 
I get the processes by using GetProccess() then cycling through each process adding it to an array of proceses. I then send the array using Winsock Orcas etc. Once the array is received i can access each process individually by cycling through the array and outputting it to the screen or whatever. What I want to be able to do is to have multiple process arrays coming in from different clients each somehow linked to its client guid. Therefore, i could then get the processes for each user individually (ie I select a user from a list and see all processes associated with it). I thought this would best be done by a class for storing all the clients info by guid. At the moment the class used to store user info has things like username and guid etc as properties. So how would I implement this?
Sergey Alexandrovich Kryukov at 23-Nov-12 1:52am
   
Not quite clear what's the problem...
--SA
Shmuli9 at 25-Nov-12 15:24pm
   
Dont worry, I have managed to solve the problem by making one of the properties in the class an array. Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 220
2 DamithSL 190
3 Raul Iloc 185
4 Richard MacCutchan 175
0 OriginalGriff 5,130
1 DamithSL 4,197
2 Maciej Los 3,670
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,821


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 22 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100