示例#1
0
        public void wcfConnect()
        {
            try
            {
                ChannelFactory <IMyContract> factory = new ChannelFactory <IMyContract>();

                // Address
                string address = "net.tcp://localhost:8080/myAddress";
                factory.Endpoint.Address = new EndpointAddress(address);

                // Binding : TCP 사용
                factory.Endpoint.Binding = new NetTcpBinding();

                // Contract 설정
                factory.Endpoint.Contract.ContractType = typeof(IMyContract);

                // Channel Factory 만들기
                IMyContract channel = factory.CreateChannel();

                // Server 쪽 함수 호출
                // 서버 : 가상환경 ubuntu 18.04
                string connstring = channel.conndb("192.168.136.129", "root", "111111", "ACK");

                // Close Channel
                ((ICommunicationObject)channel).Close();
                conn = new MySqlConnection(connstring);
            }
            catch (Exception)
            {
                MessageBox.Show("연결 실패");
            }
        }
示例#2
0
    void OnDiscoverMEX(object sender, EventArgs e)
    {
        IMyContract proxy = CreateChannel <IMyContract>();

        proxy.MyMethod();

        (proxy as ICommunicationObject).Close();
    }
示例#3
0
    void OnCallService(object sender, EventArgs e)
    {
        EndpointAddress address = m_AnnouncementSink[0];
        IMyContract     proxy   = ChannelFactory <IMyContract> .CreateChannel(new NetTcpBinding(), address);

        proxy.MyMethod();

        (proxy as ICommunicationObject).Close();
    }
示例#4
0
    void OnDiscoverAddress(object sender, EventArgs e)
    {
        EndpointAddress address = DiscoverAddress <IMyContract>();
        Binding         binding = new NetTcpBinding();

        IMyContract proxy = ChannelFactory <IMyContract> .CreateChannel(binding, address);

        proxy.MyMethod();

        (proxy as ICommunicationObject).Close();
    }
示例#5
0
 public void DoSomething( IMyContract adapter ) {
     // code here
 }
示例#6
0
        public HostSideAdapter(IMyContract contract)
        {
            _contract = contract;

            _handle = new ContractHandle(contract);
        }
示例#7
0
 public void SayHello(long val, IMyContract test)
 {
 }
示例#8
0
        public HostSideAdapter(IMyContract contract)
        {
            _contract = contract;

            _handle = new ContractHandle(contract);
        }