MSTerminalServices.org Forums

Forums Home | FAQ | Search | Profile | Private Messages | Log in/Register/Password

Data synchronisation issues on Virtual channels

Page 1 of 1
Next:  Windows 2000 TermServ Clients: RDP Server 2000 SP4- configure users  
Author Message
Marc

External


Since: Jun 12, 2006
Posts: 6



(Msg. 1) Posted: Mon Nov 06, 2006 3:16 pm
Post subject: Data synchronisation issues on Virtual channels
Archived from groups: microsoft>public>win2000>termserv>clients (more info?)

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
Back to top
Send e-mail Login to vote
Marc

External


Since: Jun 12, 2006
Posts: 6



(Msg. 2) Posted: Fri Nov 10, 2006 11:05 am
Post subject: RE: Data synchronisation issues on Virtual channels [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
>
Back to top
Send e-mail Login to vote
Display posts from previous:   
    All times are: Eastern Time (US & Canada) (change) Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Looking for more Terminal Services info?

Sign up to the MSTerminalServices.org Monthly Newsletter, written by Terminal Server MVP & Citrix CTP Stefan Vermeulen, containing news, tips, interviews, links of the month and much more. Subscribe today and don't miss a thing!

Become an MSTerminalServices.org member!

Discuss your Terminal Services & Citrix issues with thousands of other SBC experts. Click here to join!

Community Area

Log in | Register