Click here to Skip to main content
15,896,453 members
Articles / Programming Languages / C#

NetMeeting for Windows 7

Rate me:
Please Sign up or sign in to vote.
3.75/5 (9 votes)
1 Nov 2013CPOL2 min read 129.6K   10.4K   41  
Share Desktops between Windows 7 Systems
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Runtime.Serialization;
using System.ServiceModel.Channels;
using MADMeeting.ServiceLibrary;

namespace MADMeeting.MMServer
{
    public partial class MMServer : Form
    {

        //Constructor
        public MMServer(int PortNumber)
        {
            InitializeComponent();
            CMMServiceHost MSHost = new CMMServiceHost();
            MSHost.StartServer(PortNumber);

        }

    }

    public class CMMServiceHost
    {
        System.ServiceModel.ServiceHost MMServiceHost;

        public CMMServiceHost()
        {
            MMServiceHost = new System.ServiceModel.ServiceHost(typeof(MMService));
        }

        public void StartServer(int PortNumber)
        {

            try
            {

                String HTTPUri = @"http://localhost:" + PortNumber.ToString() + "/MMeeting/";
                String TCPUri = @"net.tcp://localhost:" + (PortNumber + 2).ToString() + "/MMeeting/";

                NetTcpBinding TcpBinding = new NetTcpBinding();
                WSDualHttpBinding HttpBinding = new WSDualHttpBinding();


                ServiceMetadataBehavior Metadata = new ServiceMetadataBehavior();
                Metadata.HttpGetEnabled = true;
                Metadata.HttpGetUrl = new Uri(HTTPUri);

                TcpBinding.Security.Mode = SecurityMode.None;

                MMServiceHost.AddServiceEndpoint("MADMeeting.ServiceLibrary.IMMService", HttpBinding, HTTPUri);
                MMServiceHost.AddServiceEndpoint("MADMeeting.ServiceLibrary.IMMService", TcpBinding, TCPUri);

                MMServiceHost.Description.Behaviors.Add(Metadata);

                MMServiceHost.Open();

            }
            catch (Exception ex)
            {

                MessageBox.Show("Error in Starting the Application -" + ex.Message);
            }


        }

        public void StopServer()
        {
            if (MMServiceHost.State != CommunicationState.Closed)
                MMServiceHost.Close();
        }
    }


}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead KLA-Tencor
India India
Working in KLA-Tencor, Chennai as Technical Lead. Born in Bapatla, Guntur (dt), Andhra Pradesh. B.Tech from Bapatla Engineering College, M.Tech from IIT Kanpur.

Interesting areas include Image Processing, C# .NET.

Comments and Discussions