PC Review


Reply
Thread Tools Rate Thread

Data synchronisation issues on Virtual channels

 
 
=?Utf-8?B?TWFyYw==?=
Guest
Posts: n/a
 
      6th Nov 2006
Hi

Can I have many processes write to the same virtual channel?

I am doing tests to try to understand how channels work. I have a server
side exe
and a Client.DLL running together. I am exchanging data between the two
successfully.

Using one channel on one client dll I run 10 instances of my application.exe
that
resides on the server. When all 10 applications are writing and reading data
simultaneously I am finding that the process that did the write on the
channel isn't
always the process that does the read. Another process reads the data
sitting on
the channel.

Am I supposed to have one client.dll per process running on the server?

My test is very simple I pass an integer to the client DLL increment it by 1
on the
client side and return it to the server side. I do this in a for loop.

When I run one instance my output is sequential. 1,2,3,4,5,6,7....
When I run several instances of the same exe I get something that looks like
this
1,3,5,8,11, etc... Random output.

How can make make sure the the process that did the write is the one doing
the
read, and that my writes and reads are being mixed up from process to process.

Thanks for the info,
Marc

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFyYw==?=
Guest
Posts: n/a
 
      10th Nov 2006
Here is the solution to the problem

From the server side wrap your calls in a mutex and use WaitForSingleObject .

Psuedo code
createmutex
WaitForSingleObject
WriteToChannel
ReadFromChannel
ReleaseMutex

This will guarantee that 2 processes will not write and read on the channel
simultaneously.

This also assumes you have control of both ends server and client.

Marc

--
....


"Marc" wrote:

> Hi
>
> Can I have many processes write to the same virtual channel?
>
> I am doing tests to try to understand how channels work. I have a server
> side exe
> and a Client.DLL running together. I am exchanging data between the two
> successfully.
>
> Using one channel on one client dll I run 10 instances of my application.exe
> that
> resides on the server. When all 10 applications are writing and reading data
> simultaneously I am finding that the process that did the write on the
> channel isn't
> always the process that does the read. Another process reads the data
> sitting on
> the channel.
>
> Am I supposed to have one client.dll per process running on the server?
>
> My test is very simple I pass an integer to the client DLL increment it by 1
> on the
> client side and return it to the server side. I do this in a for loop.
>
> When I run one instance my output is sequential. 1,2,3,4,5,6,7....
> When I run several instances of the same exe I get something that looks like
> this
> 1,3,5,8,11, etc... Random output.
>
> How can make make sure the the process that did the write is the one doing
> the
> read, and that my writes and reads are being mixed up from process to process.
>
> Thanks for the info,
> Marc
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RDP Virtual Channels amdrit Microsoft Dot NET 1 28th Sep 2007 04:05 PM
H E L P !!! with Virtual Channels Darren Brook Microsoft Windows 2000 Terminal Server Applications 1 8th Aug 2006 07:06 PM
virtual channels Darren Brook Microsoft Windows 2000 Terminal Server Clients 3 4th Jun 2006 05:27 PM
RDP Virtual Channels Maurizio Baldini Microsoft C# .NET 0 21st Apr 2005 09:21 AM
Virtual Channels Example Zak Microsoft Windows 2000 Terminal Server Applications 0 2nd Feb 2004 09:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:26 AM.