title: How to create a proxy for WCF service hosted in windows apps
body: <p>i am beginner for WCF. so i was reading a code online for small wcf chat.i got stuck to create wcf client for that wcf chat. the url from where i was reading <a href="http://islameldemery.blogspot.in/2008/05/wcf-serverclient-chat-sample.html" rel="nofollow">http://islameldemery.blogspot.in/2008/05/wcf-serverclient-chat-sample.html</a></p>
  
  <p>there is one part for interface and service is hosted in win form with the help of <strong>ServiceHost</strong> but i am not being able to understand how proxy was created at client end.</p>
  
  <p>they use this event below</p>
  
  <pre><code>InnerDuplexChannel.Opened
  InnerDuplexChannel.Closed
  InnerDuplexChannel.Faulted 
  </code></pre>
  
  <p>which i really do not understand. can anyone tell me how the client was created. please visit the url and please tell me how that person create a proxy at client side for that chat service.</p>
  
  <p>i tried to create a proxy dynamically like self hosted as</p>
  
  <pre><code>var myBinding = new NetTcpBinding(SecurityMode.None);
    DuplexChannelFactory&lt;ISampleChatCallback&gt; cf =
            new DuplexChannelFactory&lt;ISampleChatCallback&gt;(
                new CallbackImpl(),
                myBinding,
                new EndpointAddress("net.tcp://192.168.1.2:8080/DataService")); 
    IServerWithCallback srv = cf.CreateChannel();
  </code></pre>
  
  <p>but srv  has no event called Opened,Closed or faulted etc. i really need to understand how proxy was created at cleint end. please help me to create proxy as a result i can complete the code for client side. thanks</p>