Confused about WCF Services

I'm totally new to this WCF Services thing so any guidelines would be greatly appreciated.

I have received a large project with a code that checks for the network status of a certain device. My boss told me to search for TCPSocket creation and change certain options on the socket.

The function that checks for the status of the network is ReqDDCNetworkStatus. Naturally, I searched for the origin of code and found this interface under my Service References:

public interface LGeDDC
{
    [System.ServiceModel]
    [System.ServiceModel.XmlSerializerFormatAttribute()]
    [return: System.ServiceModel.MessageParameterAttribute(Name="result")]
    string ReqDDCNetworkStatus(out string status);
}

This file was called References.cs and I assume it was generated from running svcutil.exe on a WSDL (SOAP) file which is used to communicate between the program and the device in question.

This is the class with the actual function that gets called:

namespace XrayEngines.DDCService
{
    public partial class LGeDDCClient : System.ServiceModel.ClientBase<LGeDDC>, LGeDDC
    {
        public LGeDDCClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress)
        {
        }

        public string ReqDDCNetworkStatus(out string status)
        {
            return base.Channel.ReqDDCNetworkStatus(out status);
        }
    }
}

So the function would be called in the following way:

try
{
    for (int i = 0; i < p.Length; i++)
    {
        v = ddc.ReqDDCNetworkStatus(out r);
        writeMessage("v:" + v + " , r:" + r);
    }
}
catch (Exception e)
{
    writeMessage("Network Exception Occurred: ."+e.ToString());
}

And I'm lost. I literally do not see anything that does any establishment of connection between the client and the server, but the program works. If somebody can provide an explanation behind how the connection is established this way, I'd really appreciate it.

Answers


The magic is in these two lines:

 public partial class LGeDDCClient : System.ServiceModel.ClientBase<LGeDDC>

and

return base.Channel.ReqDDCNetworkStatus(out status);

The proxy class inherits from ClientBase, a class that implements the actual sending of the message (executing the remote call).


The base class System.ServiceModel.ClientBase does all the connection stuff. You only set the URL of the service and some more parameters, which usually is done using the config file. Check the config file for service endpoint, parameters..


Need Your Help

PHP Search Not Working When I Get To The While Loop

php mysql forms loops search

I had a search form for my website which worked perfectly fine, but I then changed my entire login system and it cause a few errors within my site. The only error now that I cant seem to fix is the

Write Ruby Output to a File

ruby terminal

I have a script that combs through a particular folder and finds all of the documents that have been modified today: