: Hi all, : I have this problem: : I have created tcp channel : TcpChannel myChannel = new TcpChannel(); : and a want to know port . Can someone help me? : : : Hi,
Try this
tcpChannel = new TcpChannel(0); ChannelServices.RegisterChannel(tcpChannel); RemotingConfiguration.RegisterWellKnownServiceType(myServerType,"MyServer",WellKnownObjectMode.SingleCall);
// pick apart the URL to retrieve the chosen port number. string[] urls = tcpChannel.GetUrlsForUri("MyServer"); string objectUri; string uri = tcpChannel.Parse(urls[0],out objectUri); string strPort = uri.Substring(uri.LastIndexOf(":")+1); port = Convert.ToInt32(strPort);
: : Hi all, : : I have this problem: : : I have created tcp channel : : TcpChannel myChannel = new TcpChannel(); : : and a want to know port . Can someone help me? : : : : : : : Hi, : : Try this : : tcpChannel = new TcpChannel(0); : ChannelServices.RegisterChannel(tcpChannel); : RemotingConfiguration.RegisterWellKnownServiceType(myServerType,"MyServer",WellKnownObjectMode.SingleCall); : : // pick apart the URL to retrieve the chosen port number. : string[] urls = tcpChannel.GetUrlsForUri("MyServer"); : string objectUri; : string uri = tcpChannel.Parse(urls[0],out objectUri); : string strPort = uri.Substring(uri.LastIndexOf(":")+1); : port = Convert.ToInt32(strPort); : : // Patrik
thanx a lot, i 'm using this( the sam idea i have used regex), but it is too slow. I'm looking for somethig faster.
Comments
: I have this problem:
: I have created tcp channel
: TcpChannel myChannel = new TcpChannel();
: and a want to know port . Can someone help me?
:
:
:
Hi,
Try this
tcpChannel = new TcpChannel(0);
ChannelServices.RegisterChannel(tcpChannel);
RemotingConfiguration.RegisterWellKnownServiceType(myServerType,"MyServer",WellKnownObjectMode.SingleCall);
// pick apart the URL to retrieve the chosen port number.
string[] urls = tcpChannel.GetUrlsForUri("MyServer");
string objectUri;
string uri = tcpChannel.Parse(urls[0],out objectUri);
string strPort = uri.Substring(uri.LastIndexOf(":")+1);
port = Convert.ToInt32(strPort);
// Patrik
: : I have this problem:
: : I have created tcp channel
: : TcpChannel myChannel = new TcpChannel();
: : and a want to know port . Can someone help me?
: :
: :
: :
: Hi,
:
: Try this
:
: tcpChannel = new TcpChannel(0);
: ChannelServices.RegisterChannel(tcpChannel);
: RemotingConfiguration.RegisterWellKnownServiceType(myServerType,"MyServer",WellKnownObjectMode.SingleCall);
:
: // pick apart the URL to retrieve the chosen port number.
: string[] urls = tcpChannel.GetUrlsForUri("MyServer");
: string objectUri;
: string uri = tcpChannel.Parse(urls[0],out objectUri);
: string strPort = uri.Substring(uri.LastIndexOf(":")+1);
: port = Convert.ToInt32(strPort);
:
: // Patrik
thanx a lot,
i 'm using this( the sam idea i have used regex), but it is too slow. I'm looking for somethig faster.