[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Datashare channels...

Hi Remy,

Remy Chi Jian Suen wrote:
Hi all,

I'm trying to implement the datashare APIs right now and am having
some problems...

The docshare code currently arbitrarily creates a channel upon
"startup". When both clients start their Eclipse, two channels are
created, one on each side. To connect to the other user, some kind of
socket connection needs to be created between the two via ServerSocket
and Socket. That's pretty straightforward, but what if there is more
than one channel?

Let's say there is a channelOne and a channelTwo on both sides. I want
to connect A's channelTwo to B's channelTwo, when A initiates a
connection request, how can the request identify itself that it wants
to connect to B's channelTwo?

The channelIDs have to match.

Actually, I guess it's not even really
possible to know that there are two channels open on B's side. B may
have other plug-ins installed and there may be 0-N channels open. What
is supposed to happen if A's channelTwo message mistakenly gets
received by B's channelOne? Am I supposed to somehow use
IChannelContainerAdapter's getChannel(ID) method for identification
purposes?

Yes.

But how is A supposed to even know the right ID to request?

Well, that's up to the application. When a channel is created, it's created with a unique ID...and somehow (through discovery, well-known name, or whatever), the name...for a given usage of the channel on 'both/all' sides...has to match. In the case of docshare, the channel ID is the same as the DocShare class name.


In the docshare case, both channels are being created "at random" on
startup, ID information does not appear to be exchanged at all.

No, the docshare channel is given the DocShare class name as it's id (at least in the initial implementation).


I feel like I'm missing something here since this seems to be a
problem everyone is going to hit if they trry to implement the
datashare APIs.

These are basically named channels. So the createChannel(ID, IChannelListener) call is where the channel is named...with the given ID.


Scott