public class RemoteServiceImpl implements RemoteService { public String greet(String name) { return "Hello, " + name + "! Welcome to the server."; } } public class RemoteServiceClient { public static void main(String[] args) { try { RemoteConnection connection = new RemoteConnection("localhost", 8080); connection.initialize(); RemoteService remoteService = connection.getRemoteService(); String greeting = remoteService.greet("John"); System.out.println(greeting); connection.close(); } catch (Exception e) { e.printStackTrace(); } } } <?xml version="1.0" encoding="UTF-8"?> <jboss-remoting xmlns="urn:jboss:remoting:3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:remoting:3.0 jboss-remoting-3_0.xsd"> <server> <configuration> <invoker transport="socket" /> </configuration> <factories> <factory code="org.jboss.remoting.transport.socket.ServerSocketFactory" class="org.jboss.remoting.transport.socket.ServerSocketFactory" /> </factories> </server> </jboss-remoting>


上一篇:
下一篇:
切换中文