This article is contributed by Wang HaiLong.
IntroductionIt seems that all the C/S based systems have similar architectures and work according to similar rules:
1. There are usually 3 parts - client, server, name directory service.
2. Server registers itself in a name directory.
3. Client locates server in a name directory.
This article lists such scenarios from aspects of Middle Ware and Network.
Middle Ware COM+A component registers itself in the registry table, while clients locate it from registry table.
An active component registers itself with a Moniker in ROT (Running Object Table), while a client uses the Moniker to find the active component from ROT.
CORBAClients can ask services from Interface Repository.
The following code is extracted from <<Core Java 2 Volume II: Advanced Features>>.
ORB orb = ORB.init(args, NULL);
String [] Services = orb.list_initial_services();
org.omg.CORBA.Object object = orb.resolve_initial_references("NameService");
NamingContext namingContext = NamingContexthelper.narrow(objcet);
EJBJNDI.
rmiregistry for RMI.The following code is extracted from <<Core Java 2 Volume II: Advanced Features>>.
String url = getCodeBase().getHost();
url = "rmi://" + url;
centralWarehouse = (Warehouse)Naming.lookup(url + "/central_warehouse");
Network SocketA server needs to bind itself to port number before a client can connect it.
Name Registration and Resolution
Network programming concerns Address Families, Name Registration and Resolution.
The following table is from << Network Programming for Microsoft Windows >>.
Name Space Description Type
NS_SAP Service Advertising Protocol (SAP) name space; used on IPX networks Dynamic
NS_NDS NetWare Directory Services (NDS) name space; also used on IPX networks Persistent
NS_DNS Domain Name System (DNS) name space; most commonly found on TCP/IP networks and on the Internet Static
ND_NTDS Windows NT domain space; protocol-independent name space found on Windows 2000
Reference<<Core Java 2 Volume II: Advanced Features>>
<<Network Programming for Microsoft Windows>>
本文地址:http://com.8s8s.com/it/it17954.htm