Hi can any1 explain this code to me? i dont qute understand.

strIPaddress is a ip address and strPort is the port number.

_objExtAccess=(IExtranetAccess)Activator.GetObject(
                typeof(IExtranetAccess),
                "tcp://"+strIPAddress+":"+strPort+"/ExtranetAccessService");

Thanks.

Recommended Answers

All 6 Replies

They are using Activator.GetObject to create an object of type IExtranetAccess, the description of which is at "tcp://"+strIPAddress+":"+strPort+"/ExtranetAccessService". Since Activator.GetObject returns an Object, they cast it into an IExtranetAccess object and assign it to _objExtAccess

Hi,

How do i access this url? i run the exe file.. but the error indicate that i cannot connect to extranet.

That means that you either don't have the ability to connect on that port (it's blocked, ip is blocked, etc.) or that there is no service running on that port to provide you the object.

If the strIPAddress is 'localhost'.. will it be able to connect???

strIPAddress

strIPAddress

Do you have a service running on the port for it to connect to?

Hi,

How do i vertify if there is service on the port running? i used netstat -a.. but cant find the port that indicate in the code. Is there alternative way i can vertify the port?

Thanks for the help =)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.