Click here to Skip to main content
15,879,096 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
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
Comments
Sergey Alexandrovich Kryukov 21-Nov-12 18:43pm    
What is "send processes"? How a process can be sent?
--SA

1 solution

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
 
Share this answer
 
Comments
Nelek 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 23-Nov-12 1:52am    
Not quite clear what's the problem...
--SA
Shmuli9 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900