[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

New TcpChannel, client side

Phil Greg

11/4/2004 3:29:00 PM

Hi,
When using client callbacks, I understand you need to define a TcpChannel
with a port number (ex.: new TcpChannel(8887)), instead of the regular one
way constructor (new TcpChannel()). However, when you run two instances of
the same client on the same computer, you get an exception since both clients
want to use the same channel. How would you get around that?
4 Answers

Phil Greg

11/4/2004 3:34:00 PM

0

I guess I could start up by opening a normal TcpChannel, then ask the
server(who would keep track) which ports already are opened, then open a new
TcpChannel with the next available port, but that seems a little ankward.
Anyone know of an easier way?

Robert Jordan

11/4/2004 4:37:00 PM

0

Hi Phil,

> When using client callbacks, I understand you need to define a TcpChannel
> with a port number (ex.: new TcpChannel(8887)), instead of the regular one
> way constructor (new TcpChannel()). However, when you run two instances of
> the same client on the same computer, you get an exception since both clients
> want to use the same channel. How would you get around that?

use new TcpChannel(0).

bye
Rob

Ken Kolda

11/4/2004 4:48:00 PM

0

To allow for callbacks, use:

new TcpChannel(0)

The "0" tells .NET to open a server channel on a randomly selected port as
needed so you don't have to specify a port number.

Ken


"Phil Greg" <PhilGreg@discussions.microsoft.com> wrote in message
news:BA068B2F-30FB-4613-AEF0-BBA616441EDF@microsoft.com...
> Hi,
> When using client callbacks, I understand you need to define a TcpChannel
> with a port number (ex.: new TcpChannel(8887)), instead of the regular one
> way constructor (new TcpChannel()). However, when you run two instances of
> the same client on the same computer, you get an exception since both
clients
> want to use the same channel. How would you get around that?


Phil Greg

11/4/2004 4:56:00 PM

0

Wow, that was simple... Thanks a lot!!

"Robert Jordan" wrote:

> Hi Phil,
>
> > When using client callbacks, I understand you need to define a TcpChannel
> > with a port number (ex.: new TcpChannel(8887)), instead of the regular one
> > way constructor (new TcpChannel()). However, when you run two instances of
> > the same client on the same computer, you get an exception since both clients
> > want to use the same channel. How would you get around that?
>
> use new TcpChannel(0).
>
> bye
> Rob
>