1 Reply Latest reply on Aug 9, 2007 6:00 PM by Ron Sigal

    Socket client with JBoss Remoting

    Rodrigo Iannuzzi Newbie

      I'm trying to make a simple socket client using JBoss Remoting. My code is the following:

      InvokerLocator locator = new InvokerLocator("socket://");
      Client remotingClient = new Client(locator);
      System.out.println(remotingClient.invoke("Teste Remoting"));

      I have a server socket that does not use JBoss Remoting. The code is the following:

      server = new ServerSocket(4322);
      client = server.accept();
      in = new BufferedReader(new InputStreamReader(client.getInputStream()));
      out = new PrintWriter(client.getOutputStream(), true);
      String line = in.readLine();
      if (line != null){
      System.out.println("Server - Recebendo:" + line);
      out.println("Resposta:" + line);
      System.out.println("Server - Enviando:" + line);

      But the following exception occurs:
      Can not get connection to server. Problem establishing socket connection for InvokerLocator.

      Someone can help me?

        • 1. Re: Socket client with JBoss Remoting
          Ron Sigal Master

          Yeah, that's not going to work. SocketClientInvoker wants to talk to a SocketServerInvoker. For example, in Remoting versions 2.0.0 and above, each invocation and each response is preceded by a version byte. For another, the client will try to create an ObjectInputStream, which means the server has to create a matching ObjectOutputStream.

          Basically, you'd have to make your server code look sufficiantly like a SocketSereverInovker to satisfy the SocketClientInvoker.