Endpoint--Address

本文详细介绍了Windows Communication Foundation (WCF),一种用于在Windows平台上开发和服务部署的SDK。WCF提供了一个运行时环境,使开发者能够将CLR类型作为服务暴露,并消费其他服务为CLR类型。文章还介绍了WCF中使用的各种地址方案,包括HTTP、TCP、IPC、MSMQ和Peer Network等。
What is WCF?
    Windows Communication Foundation(WCF) is an SDK for developing and deploying services on Windows. WCF provides a runtime environment for your services, enbabling you to expose CLR types as services,and to consume other servives as CLR types. In .NetFrameWork, most all of the WCF functionality is included in a single assembly called System.ServiceModel.dll in the system.servicemodel namespace.

EndPoint:
    The Endpoint is the fusion of the address,binding and contract
and in this text, I will say s.th about Address

Address:
In WCF, every service is associated with a unique address, The address provides two important elements:the location of the service and the transport protocal or tranport schema used to communicate with the service. WCF 1.0 supports the following transport schemas:
    1)HTTP
    2)TCP
    3)Peer Network
    4)IPC(Inter-Process Communication named pipes)
    5)MSMQ

HTTP Address
    Http address use http for transport, and can also use https for secure transport. you tipically use http addresses with a speicified port ,such as:
    http://localhost:8001
   comments: if the port number is unspecified, it defauts to 80.
TCP Address
    TCP Address use net.tcp for the transport,and typically include a port number such as:
    net.tcp://localhost:8002/myservice
    comments:if the port number is unspecified, it defaults to 808.
    it is possible for two tcp address(from the same host) to share a port:
    net.tcp://localhost:8002/myservice
    net.tcp://localhost:8002/myotherservice
IPC Address
    IPC Address use net.pipe for transport, to indicate the use of the windows named pipe mechnism. In WCF, services that use named piped can only accept calls from the same machine. consequently, you must specify either the explicit local machine name or localhost,for the machine name, followed by a unique string for the pipe name:
    net.pipe://localhost/mypipe
    you can only open a named pipe once per machine. and  therefore it's impossible for two named pipe addressed to share a pipe name on the same machine.
MSMQ Address
    MSMQ Address use net.msmq for tranport, to indicate the use of the MSMQ. you must specify the queue name and queue type.the samples such as:
    net.msmq://localhost/private/myservice
    net.msmq://localhost/myservice
Peer Network Address
    Peer Network addresss use net.p2p for tranport, to indicate the use of the  windows peer network tranport.



转载于:https://www.cnblogs.com/Winston/archive/2008/04/16/1154732.html

import xml.etree.ElementTree as ET ecu_net_data = [ ("ITM_MCU_VLAN_510", "172.31.51.101", "FIXED", "255.255.255.0"), ("ITM_SOC_VLAN_510", "172.31.51.100", "FIXED", "255.255.255.0"), ("NetworkEndpointANY", "ANY"), ("X237_51_0_1", "237.51.0.1", "FIXED") ] python代码,利用上述ecu_net_data生成如下xml内容 <NETWORK-ENDPOINTS> <NETWORK-ENDPOINT> <SHORT-NAME>ITM_MCU_VLAN_510</SHORT-NAME> <NETWORK-ENDPOINT-ADDRESSES> <IPV-4-CONFIGURATION> <IPV-4-ADDRESS>172.31.51.101</IPV-4-ADDRESS> <IPV-4-ADDRESS-SOURCE>FIXED</IPV-4-ADDRESS-SOURCE> <NETWORK-MASK>255.255.255.0</NETWORK-MASK> </IPV-4-CONFIGURATION> </NETWORK-ENDPOINT-ADDRESSES> </NETWORK-ENDPOINT> <NETWORK-ENDPOINT> <SHORT-NAME>ITM_SOC_VLAN_510</SHORT-NAME> <NETWORK-ENDPOINT-ADDRESSES> <IPV-4-CONFIGURATION> <IPV-4-ADDRESS>172.31.51.100</IPV-4-ADDRESS> <IPV-4-ADDRESS-SOURCE>FIXED</IPV-4-ADDRESS-SOURCE> <NETWORK-MASK>255.255.255.0</NETWORK-MASK> </IPV-4-CONFIGURATION> </NETWORK-ENDPOINT-ADDRESSES> </NETWORK-ENDPOINT> <NETWORK-ENDPOINT> <SHORT-NAME>NetworkEndpointANY</SHORT-NAME> <NETWORK-ENDPOINT-ADDRESSES> <IPV-4-CONFIGURATION> <IPV-4-ADDRESS>ANY</IPV-4-ADDRESS> </IPV-4-CONFIGURATION> </NETWORK-ENDPOINT-ADDRESSES> </NETWORK-ENDPOINT> <NETWORK-ENDPOINT> <SHORT-NAME>X237_51_0_1</SHORT-NAME> <NETWORK-ENDPOINT-ADDRESSES> <IPV-4-CONFIGURATION> <IPV-4-ADDRESS>237.51.0.1</IPV-4-ADDRESS> <IPV-4-ADDRESS-SOURCE>FIXED</IPV-4-ADDRESS-SOURCE> </IPV-4-CONFIGURATION> <MAC-MULTICAST-CONFIGURATION> <MAC-MULTICAST-GROUP-REF DEST="MAC-MULTICAST-GROUP">/Topology/Clusters/EthernetCluster16/MulticastMACAddress4</MAC-MULTICAST-GROUP-REF> </MAC-MULTICAST-CONFIGURATION> </NETWORK-ENDPOINT-ADDRESSES> </NETWORK-ENDPOINT> </NETWORK-ENDPOINTS>
03-08
import xml.etree.ElementTree as ET sd_sock_addr_data = [ ("SD_SoAddr_ANY", "SD_ApplicationEndpoint_ANY", "VLAN_510/NetworkEndpointANY", 30490), ("SD_SoAddr_ITM_MCU_VLAN_510", "AppEndpoint_ITM_MCU_VLAN_510", "VLAN_510/ITM_MCU_VLAN_510", 30490, "ITM_MCU/ECUInterface_ITM_MCU_VLAN_510"), ("SD_SoAddr_ITM_SOC_VLAN_510", "AppEndpoint_ITM_SOC_VLAN_510", "VLAN_510/ITM_SOC_VLAN_510", 30490, "ITM_SOC/ECUInterface_ITM_SOC_VLAN_510"), ("SD_SoAddr_Multicast", "SD_ApplicationEndpoint_Multicast", "VLAN_510/X237_51_0_1", 30490, "ITM_MCU/ECUInterface_ITM_MCU_VLAN_510", "ITM_SOC/ECUInterface_ITM_SOC_VLAN_510") ] python代码,利用上述ecu_net_data生成如下xml内容 <SOCKET-ADDRESS> <SHORT-NAME>SD_SoAddr_ANY</SHORT-NAME> <APPLICATION-ENDPOINT> <SHORT-NAME>SD_ApplicationEndpoint_ANY</SHORT-NAME> <NETWORK-ENDPOINT-REF DEST="NETWORK-ENDPOINT">/Topology/Clusters/EthernetCluster16/VLAN_510/NetworkEndpointANY</NETWORK-ENDPOINT-REF> <TP-CONFIGURATION> <UDP-TP> <UDP-TP-PORT> <PORT-NUMBER>30490</PORT-NUMBER> </UDP-TP-PORT> </UDP-TP> </TP-CONFIGURATION> </APPLICATION-ENDPOINT> </SOCKET-ADDRESS> <SOCKET-ADDRESS> <SHORT-NAME>SD_SoAddr_ITM_MCU_VLAN_510</SHORT-NAME> <APPLICATION-ENDPOINT> <SHORT-NAME>AppEndpoint_ITM_MCU_VLAN_510</SHORT-NAME> <NETWORK-ENDPOINT-REF DEST="NETWORK-ENDPOINT">/Topology/Clusters/EthernetCluster16/VLAN_510/ITM_MCU_VLAN_510</NETWORK-ENDPOINT-REF> <TP-CONFIGURATION> <UDP-TP> <UDP-TP-PORT> <PORT-NUMBER>30490</PORT-NUMBER> </UDP-TP-PORT> </UDP-TP> </TP-CONFIGURATION> </APPLICATION-ENDPOINT> <CONNECTOR-REF DEST="ETHERNET-COMMUNICATION-CONNECTOR">/Topology/HardwareComponents/ITM_MCU/ECUInterface_ITM_MCU_VLAN_510</CONNECTOR-REF> </SOCKET-ADDRESS> <SOCKET-ADDRESS> <SHORT-NAME>SD_SoAddr_ITM_SOC_VLAN_510</SHORT-NAME> <APPLICATION-ENDPOINT> <SHORT-NAME>AppEndpoint_ITM_SOC_VLAN_510</SHORT-NAME> <NETWORK-ENDPOINT-REF DEST="NETWORK-ENDPOINT">/Topology/Clusters/EthernetCluster16/VLAN_510/ITM_SOC_VLAN_510</NETWORK-ENDPOINT-REF> <TP-CONFIGURATION> <UDP-TP> <UDP-TP-PORT> <PORT-NUMBER>30490</PORT-NUMBER> </UDP-TP-PORT> </UDP-TP> </TP-CONFIGURATION> </APPLICATION-ENDPOINT> <CONNECTOR-REF DEST="ETHERNET-COMMUNICATION-CONNECTOR">/Topology/HardwareComponents/ITM_SOC/ECUInterface_ITM_SOC_VLAN_510</CONNECTOR-REF> </SOCKET-ADDRESS> <SOCKET-ADDRESS> <SHORT-NAME>SD_SoAddr_Multicast</SHORT-NAME> <APPLICATION-ENDPOINT> <SHORT-NAME>SD_ApplicationEndpoint_Multicast</SHORT-NAME> <NETWORK-ENDPOINT-REF DEST="NETWORK-ENDPOINT">/Topology/Clusters/EthernetCluster16/VLAN_510/X237_51_0_1</NETWORK-ENDPOINT-REF> <TP-CONFIGURATION> <UDP-TP> <UDP-TP-PORT> <PORT-NUMBER>30490</PORT-NUMBER> </UDP-TP-PORT> </UDP-TP> </TP-CONFIGURATION> </APPLICATION-ENDPOINT> <MULTICAST-CONNECTOR-REFS> <MULTICAST-CONNECTOR-REF DEST="ETHERNET-COMMUNICATION-CONNECTOR">/Topology/HardwareComponents/ITM_MCU/ECUInterface_ITM_MCU_VLAN_510</MULTICAST-CONNECTOR-REF> <MULTICAST-CONNECTOR-REF DEST="ETHERNET-COMMUNICATION-CONNECTOR">/Topology/HardwareComponents/ITM_SOC/ECUInterface_ITM_SOC_VLAN_510</MULTICAST-CONNECTOR-REF> </MULTICAST-CONNECTOR-REFS> </SOCKET-ADDRESS>
03-08
<SOCKET-ADDRESS> <SHORT-NAME>SoAddr_ITM_SOC_VLAN_510_UDP</SHORT-NAME> <APPLICATION-ENDPOINT> <SHORT-NAME>AppEndpoint_ITM_SOC_VLAN_510_UDP</SHORT-NAME> <CONSUMED-SERVICE-INSTANCES> <CONSUMED-SERVICE-INSTANCE> <SHORT-NAME>Client_ADC_RX_VehicleCAN_Service_VLAN_510_Instance_1_ITM_SOC_UDP</SHORT-NAME> <CONSUMED-EVENT-GROUPS> <CONSUMED-EVENT-GROUP> <SHORT-NAME>CEG_Event_RawCANDataOfVehicle_Instance_1_ITM_SOC</SHORT-NAME> <APPLICATION-ENDPOINT-REF DEST="APPLICATION-ENDPOINT">/Topology/Clusters/EthernetCluster16/VLAN_510/SoAddr_ITM_SOC_VLAN_510_UDP/AppEndpoint_ITM_SOC_VLAN_510_UDP</APPLICATION-ENDPOINT-REF> <EVENT-GROUP-IDENTIFIER>32769</EVENT-GROUP-IDENTIFIER> <ROUTING-GROUP-REFS> <ROUTING-GROUP-REF DEST="SO-AD-ROUTING-GROUP">/SoAdRoutingGroups/SoAdRG_Event_RawCANDataOfVehicle_ADC_RX_VehicleCAN_Service_Instance_1</ROUTING-GROUP-REF> </ROUTING-GROUP-REFS> <SD-CLIENT-CONFIG> <REQUEST-RESPONSE-DELAY> <MAX-VALUE>0.05</MAX-VALUE> <MIN-VALUE>0.01</MIN-VALUE> </REQUEST-RESPONSE-DELAY> <TTL>3</TTL> </SD-CLIENT-CONFIG> </CONSUMED-EVENT-GROUP> </CONSUMED-EVENT-GROUPS> <PROVIDED-SERVICE-INSTANCE-REF DEST="PROVIDED-SERVICE-INSTANCE">/Topology/Clusters/EthernetCluster16/VLAN_510/SoAddr_ITM_MCU_VLAN_510_UDP/AppEndpoint_ITM_MCU_VLAN_510_UDP/Server_ADC_RX_VehicleCAN_Service_VLAN_510_Instance_1_ITM_MCU_UDP</PROVIDED-SERVICE-INSTANCE-REF> <SD-CLIENT-CONFIG> <CLIENT-SERVICE-MAJOR-VERSION>1</CLIENT-SERVICE-MAJOR-VERSION> <CLIENT-SERVICE-MINOR-VERSION>0</CLIENT-SERVICE-MINOR-VERSION> <INITIAL-FIND-BEHAVIOR> <INITIAL-DELAY-MAX-VALUE>0.05</INITIAL-DELAY-MAX-VALUE> <INITIAL-DELAY-MIN-VALUE>0.01</INITIAL-DELAY-MIN-VALUE> <INITIAL-REPETITIONS-BASE-DELAY>0.05</INITIAL-REPETITIONS-BASE-DELAY> <INITIAL-REPETITIONS-MAX>3</INITIAL-REPETITIONS-MAX> </INITIAL-FIND-BEHAVIOR> <TTL>3</TTL> </SD-CLIENT-CONFIG> </CONSUMED-SERVICE-INSTANCE> </CONSUMED-SERVICE-INSTANCES> <NETWORK-ENDPOINT-REF DEST="NETWORK-ENDPOINT">/Topology/Clusters/EthernetCluster16/VLAN_510/ITM_SOC_VLAN_510</NETWORK-ENDPOINT-REF> <TP-CONFIGURATION> <UDP-TP> <UDP-TP-PORT> <PORT-NUMBER>50101</PORT-NUMBER> </UDP-TP-PORT> </UDP-TP> </TP-CONFIGURATION> </APPLICATION-ENDPOINT> </SOCKET-ADDRESS> 利用python字典数组,编写代码生成上述xml内容
最新发布
03-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值