Java server/client archetecture

how would I go about setting up a connection with a client and maintaining it by sending info back and fourth

1. java.net.ServerSocket and java.net.Socket
2. java.nio.channels.ServerSocketChannel and java.nio.channels.SocketChannel
3. Mixture of the above.
4. RMI
5. RMI/IIOP
6. IDL
7. Web services
and there are more ...

Similar Messages

  • Java Server/Client Applicaton - problem with sending data back

    Hello!
    I'm trying to write a small server/client chat application in Java. It's server with availability to accept connections from many clients and it's app just for fun... However, I've come up against a huge problem: everything what clients send, arrives to server (I'm sure about that because it is displayed on the Server Application screen) and then server should send it back to all clients but it doesn't work. I have no faintest idea what causes this problem. Maybe you can help me?
    Here is my server app code:
    import java.net.*;
    import java.util.*;
    import java.io.*;
    * @author Robin
    public class Server {
        ServerSocket serw = null;
        Socket socket = null;
        String line = null;
        Vector<ClientThread> Watki = new Vector();
        ClientThread watek = null;
        public Server(int port) {
            try {
                serw = new ServerSocket(port);           
                line = "";
                while(true) {
                    System.out.println("Running. Waiting for client to connect...");
                    socket = serw.accept();
                    System.out.println("Connected with:\n" + socket.getInetAddress() + "\n");
                    watek = new ClientThread(socket);
                    Watki.addElement(watek);
                    Watki.firstElement().Send("doszlo?");
            }catch (IOException e) {
                System.out.println("BLAD: " + e);
        public void sendToAll(String s) {
            for(int i = 0; i < Watki.size(); i++) {
                Watki.elementAt(i).Send(s);
        public class ClientThread extends Thread {
            Socket socket;
            DataInputStream in = null;
            DataOutputStream out = null;
            String line = null;
            public ClientThread(Socket s) {
                try {
                    this.socket = s;
                    in = new DataInputStream(s.getInputStream());
                    out = new DataOutputStream(s.getOutputStream());
                    start();
                }catch (IOException e) {
                    System.out.println("BLAD: " + e);
            public void Send(String s) {
                try {
                    out.writeUTF(s);
                }catch (IOException e) {
                    System.out.println("BLAD: " + e);
            public void run() {
                try {
                    line = "";
                    while (true) {
                        line = in.readUTF();
                        System.out.println(line);
                        sendToAll(line);
                }catch (IOException e) {
                    System.out.println("BLAD: " + e);
        public static void main(String[] args) {
            Server serwer = new Server(5000);
    }And here is client app code:
    import java.net.*;
    import java.util.*;
    import java.io.*;
    * @author Robin
    public class Client implements Runnable {
        Socket socket = null;
        BufferedReader keyIn = new BufferedReader(new InputStreamReader(System.in));
        DataInputStream in = null;
        DataOutputStream out = null;
        String line = null;
        public Client(String host, int port) {
            try {
                System.out.println("Connecting to " + host + ":" + port);
                socket = new Socket(host, port);
                System.out.println("Connected\nTALK:");
                out = new DataOutputStream(socket.getOutputStream());
                in = new DataInputStream(socket.getInputStream());
                line = "";
                while(!line.toLowerCase().equals(".bye")) {
                    line = keyIn.readLine();
                    Send(line);
            }catch (UnknownHostException e) {
                System.out.println("BLAD: " + e);
            }catch (IOException e) {
                System.out.println("BLAD: " + e);
        public void Send(String s) {
            try {
                out.writeUTF(s);
            }catch (IOException e) {
                System.out.println("BLAD: " + e);
        public void run() {
            String loaded = "";
            try {
                while(true) {
                    loaded = in.readUTF();
                    System.out.println(loaded);
            }catch (IOException e) {
                System.out.println("BLAD: " + e);
        public static void main(String[] args) {
            Client client = new Client("localhost", 5000);
    }By the way, this app is mainly written in English language (text that appears on the screen) however in functions I used Polish language (for example: BLAD - it means ERROR in English). Sorry for that :)

    Yeap, I will change those exceptions later, thanks for advice.
    You asked what's going on with it: both applications start with no errors, but when I write something in client side it should be sent to the server and then forwarded to all connected clients but it stops somewhere. However, I added a one line to the server code
    line = in.readUTF();
    System.out.println(line);
    sendToAll(line); and after it reads message from client (no matter which one) it shows that message on the server side screen, then it should send this message to all clients but it doesn't work in this moment. What's confusing: no errors occurs, so it's rather a mistake in my code, but where?
    Edited by: Robin3D on Sep 30, 2009 9:07 AM

  • Testing Java & server-client

    Im new in Java and Im testing some 'How-to�s' before go deeply in develop sofware with Java.
    I have face this problem :
    About printing PDF files.
    I have a PDF file in my server, the server is in Linux, and the name of the printer of the client too. (by example 'theprinter' The client is in windows, probably XP
    I think that the jobs that I must to do are the follows :
    1�) Download the PDF file from the server to the client-machine
    2�) send the file to the printer, directly. Without asking for a printer to print.
    Question 1� �Where I can look for the guidelines to make this 2 works?
    Question 2� �is ,in any place, a source code where I can see how to do thoses works?
    Im interesting much to learn how to do that.
    Thanks in advanced.
    Regards

    Because when you have 2000 PDF files to print, clik on the print buttom 2000 times is a job tedious an stupid.
    Best is that your application do it for your customers.
    Regarsd

  • Data transfer between C client and Java server

    Hello there
    I am working on a project where I have to develop a Client based on C and Server based on Java. The client can connect to Java server and it then sends a integer/string to Java server. But.. Java server unable to receive that and throws an IOException.
    I use write method to send the integer buffer to the socket.
    int out_buffer = 0;
    int *pbuf;
    pbuf = &out_buffer;
         if (write(acskfd, pbuf, 4)< 0){
                   syslog(LOG_ERR,"Write failed. %s(%d)", strerror(errno), errno);
                   printf("\tCLIENT:\tWrite failed\n");
                   exit(1);
    In Java, i use DatainputStream and readnInt method to read the integer from the stream.
    cl_sock = socket_out.accept();
    DataInputStream sInput =new DataInputStream(cl_sock.getInputStream()) ;
    int cmd = sInput.readInt();
    Am I missing someting.. Any suggestions would be really really helpful.
    Thanks
    Ithaca
    PS: I running both programs in the same machine.
    In C part, I also use host to network byte order conversion (serv_addr.sin_port = htons(portno).

    I would suggest writing a Java client to perform the same tasks as the C client.
    Then if the Java client does, or does not work this can help dteremine which end is at fault.
    Are you flushing your data from the client?

  • UDP DatagramPacket sent between C (client) and Java (server)

    Hi,
    I have a problem sending a struct from C to Java UDP server.
    In the C (client) program, the struct is defined as
    typedef strurct dataType_s {
    char name[52];
    char add[52];
    long x;
    long y;
    } dataType;
    dataType data;
    strcpy(data.name, "sun");
    strcpy(data.add, "com");
    data.x = 100;
    data.y = 50;
    sendto(sock, (struct dataType*)&dataType, sizeof(dataType), (struct sockaddr*)&dest, sizeof(dest))
    In the Java server side, I have the following code.
    byte[] buffer = new Byte[1024];
    DatagramPacket packet = new DatagramPacket(buffer, 1024);
    udpSock.receive(buffer);
    byte[] data = buffer.getData();
    String name = new String(data, 0, 52);
    String add = new String(data, 52, 52);
    String _xx = new String(data, 104, 4);
    String _yy = new String(data, 108, 4);
    Byte x = new Byte(xx.getBytes());
    long x = _x.longValue();
    Byte y = new Byte(yy.getBytes());
    long y = _y.longValue();
    I am having problem to read the contents of x and y above. The string name and add received by the server
    are correct. However, I receive garbage value
    for x (long) and y (long). In fact, I get expection
    that I cannot create Byte x and Byte y as shown
    above. Any idea of how to send a mixture of types
    from C/C++ to Java server?
    Thanks a lot.
    Kelvin ([email protected])

    sendto(sock, (struct dataType*)&dataType,
    sizeof(dataType), (struct sockaddr*)&dest,
    sizeof(dest))You have to check the alignment of your structs. You can't be sure that a long takes up four bytes. It can very well be 8 bytes or something else depending on your settings at compilation.
    udpSock.receive(buffer);
    byte[] data = buffer.getData();I suppose this is a typo, but of course you should use packet not buffer here.
    >
    Byte x = new Byte(xx.getBytes());
    long x = _x.longValue();
    Byte y = new Byte(yy.getBytes());
    long y = _y.longValue();
    in my opinion its easier to use a DataInputStream instead:
    DataInputStream in = new DataInputStream(new ByteArrayInputStream(data));
    int y = in.readInt();
    Notice that a long in Java is 8 bytes. A C long corresponds to a Java int.
    /Per-Arne

  • Java server and C# client

    Hallo,
    Please, Can you help me. I´m looking for Java server run on the Linux Debian.
    The Server in Java must be very good implementation (connect many client-500workstation).
    I have workstation ( Microsoft Windows XP, 7 ) and on the workstation must be client(in C#).
    The client say: a need information from Database and connecting to the Server in Java. The server in Java
    connect to the - Database(Oracle) and send information back to the workstation
    and workstation save as file.This is process before starting Windows, I need information
    for the starting script.
    For the Example, I have in databese name of instalation pack.
    Example implemention :
    On the workstation running agent.exe as service. I say in my script:
    (agent.exe -IdPack) and my agent connect to the Server and downloading information and save to the
    file(for example XML) in computer.
    Please, Do you know any solution?Any source code?project?
    I think, the server on the linux can be implementation in java servlet or next programming language.
    Thank You. Lukas

    Lukas-Firewall wrote:
    I´m administrator on the network. And we have information about computer in Oracle database. The information we need on the workstation windows and I need downloading from Database in Oracle and I need server which connect to the database and send back to the workstation the information. Do you understand me?So you have information in a database, and want some way of having that information accessible on Windows desktops? I don't see any need for C# clients here, surely a simple web app in a container like Tomcat will suffice? How complex is this information? In fact, so far I haven't seen any reason why you even need Java here. Can't you just throw some PHP at it? Where does C# come into the equation? Writing a custom rich client can often be avoided by using a web browser, especially if it's just a matter of taking some data from a DB and displaying it - makes your life much simpler.

  • Java Server / c++ Client

    Hi !
    I am trying to do a simple application to send strings between java Server and a c++ client,
    I can do the whole thing in java, but no much experience in c++. (I guess it is no necessary to use CORBA)
    Do you know where I can get some information about this ?
    Thanks.

    you do not need to use CORBA, though that is one way to get two processes to communicate, there are many others.
    I would suggest using sockets. Take a look at the java.net package in particular, java.net.ServerSocket for your server. For the client it depends on the OS you want to run it under. For UNIX, I would recommend looking at a copy of UNIX network programming by W. Richard Stevens, but to summarize, you will need to use the connect system call (most likley defined in /usr/include/net/socket). I know there are similar system calls for Wintendo, but I dont know what they are called (my guess is WinFileHandle ConnectWin32( 500 arguments.......)), but searching the Wintel docs for Connect and Socket should get you there

  • After installing Final cut server client on OSX 10.6.8 error: Apple QuickTime or the QuickTime Java component is not installed.

    After installing Final cut server client on OSX 10.6.8 error: Apple QuickTime or the QuickTime Java component is not installed.
    I know this error on windows machines but cannot get a solution for OSX.

    I have fixed this by installing the latest combo update

  • Printing a hashtable to screen, Server & Client (Java & CORBA)

    Hi all,
    I have written a server method that prints a hashtable's contents to screen:
         public void viewAllEquipment () throws noEquipmentInTable {
              // Does any equipment exist?
              if (equipmentList.isEmpty() == true) {
                   throw new noEquipmentInTable();
              System.out.println("The equipment list is as follows: ");
                    Enumeration tableEntries = equipmentList.keys();
                    int i = 1;
                    while (tableEntries.hasMoreElements()) {        
                    String names = (String) tableEntries.nextElement();
                    System.out.print(i + ". Name = " + names + ", Description = " + equipmentList.get(names));
                    i++;
         }The Client uses simple code to call this method:
    hireCompanyServant.viewAllEquipment();As I'm sure you're probably aware, the Hashtable's contents gets printed to the Server screen not the Client screen! How can I get it printing on the Client instead? I'm unsure whether returning a value via the method would work, and can't think of any other way to do this.
    Any help would be greatly appreciated.
    Thanks
    Edited by: JonBetts2004 on Mar 7, 2008 5:14 AM

    Haha, ok sorry, will do. It's all command-line based, CORBA client-sever model.
    Client: A file/program that implements and calls methods given by the Server.
    Server: A file/program that contains methods that can be called by other clients/servers.
    Screen: command line interface.
    As it is a CORBA implementation, an ORB is started, then the Java Server is started, and finally the Java Client is run in the command prompt, which shows a list of actions to take (add equipment, edit equipment, view equipment, etc).
    Sorry if that's too vague, I find these things hard to explain.
    But basically, the 'client' makes use of the viewAllEquipment method provided by the 'server', which prints the contents of a hashtable to the command line. It is printed to the Server's command line rather than the Client's. I need it printing to the Client's command line, but am unsure what is the best way to approach it. Changing the method from a void to a string, and then returning a value? Or something else?
    thanks

  • How to get started on java applet client/server game?

    Hi,
    I've googled, but didn't find any useful information about creating java applet client/server game. I've followed the example of Client/Server Tic-Tac-Toe Using a Multithreaded Server in Java How to Program from Deitel, but I when I tried on Applet, my cliet doesn't communicate with the server at all. Any help to get started with Applet would be great. Thanks!

    well, i decided to put in portion of my codes to see if anyone can help me out. the problem I have here is the function excute() never gets called. here is my coding, see if you can help. Notice, I'm running this on Applet thru html page. This shouldn't be much different than running JFrame in term of coding right?
    Server.java
        public void init()
            runGame = Executors.newFixedThreadPool(2);
            gameLock = new ReentrantLock();
            otherPlayerConnected = gameLock.newCondition();
            otherPlayerTurn = gameLock.newCondition();
            players = new Player[2];
            currentPlayer = Player1;
            try
                server = new ServerSocket(12345, 2);
            catch (IOException ie)
                stop();
            message = "Server awaiting connections";
        public void execute()
           JOptionPane.showMessageDialog(null, "I'm about to execute!", "Testing", JOptionPane.PLAIN_MESSAGE);
            for(int i = 0; i < players.length; i++)
                try
                    players[i] = new Player(server.accept(), i);
                    runGame.execute(players);
    catch (IOException ie)
    stop();
    gameLock.lock();
    try
    players[Player1].setSuspended(false);
    otherPlayerConnected.signal();
    finally
    gameLock.unlock();
    Client.java
        public void init()
            startClient();
        public void startClient()
            try
                connection = new Socket(InetAddress.getByName(TienLenHost), 12345);
                input = new Scanner(connection.getInputStream());
                output = new Formatter(connection.getOutputStream());
            catch (IOException ie)
                stop();
            ExecutorService worker = Executors.newFixedThreadPool(1);
            worker.execute(this);
        }So after worker.execute(this), it should go to Server.java and run the function execute() right? But in my case, it doesn't. If you know how to fix this, please let me know. Thanks!

  • Flash client communication with Java server

    I have written a Flash client in actionscript-3 and I have a Java server that is running locally using command prompt. I run the Flash app using Ctrl+Enter in Flash CS4 IDE and I am trying to receive some numbers from the server. I get the following message at trace output:
    Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: file:///C|/Documents%20and%20Settings/****/My%20Documents/CODE/FLASH/FlashApp/FlashApp.sw f cannot load data from localhost:12345.
    Why? What must i do to overcome this?
    Also when i publish the Flash app and use xampp to run a local web server and then use web browser to access FlashApp.html i also cannot receive any numbers from the java socket server that runs locally (on the same pc as the flash app does).

    Flash makes a request to the socket server automatically, if it doesn't get the proper response (a cross-domain XML document), then it won't connect.
    Here are a couple of links to get you started:
    http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c60.html
    http://www.adobe.com/devnet/air/flex/quickstart/articles/communicating_with_sockets.html
    If you have questions after reviewing these articles, let me know.

  • MFC Client cannot send message to a Java Server

    Hi All,
    I have a Java Server which listens on a TCP Socket. The client is a MFC based application and needs to communicate with the Server using simple raw text messages.
    We were able to connect to the Java Server using CSocket and CAsyncSocket objects but were not able to send messages.
    This is the code that we are trying:
    mySock = new CAsyncSocket(); // mySock is a CAsyncSocket object.,
    mySock->Create();
    mySock->Connect(strIP,lngPort);
    mySock->Send(strMessage, nSize);
    The server log shows that the connection is established, but the message doesnt reach.
    Please help !
    Thanks !!
    Sudhakar.

    I have the same problem.
    The Java (server) end is straightforward...
    Ian
    import java.io.*;
    import java.net.*;
    public class Serv extends Thread
         public static final int PORT = 3011;
         public static final String REQUEST = "REQUEST";
         /** Test */
         public static void main(String[] args)
              Serv s = new Serv();
              s.start();
         Serv()
              try
                   // Real code will set this class to be a daemon thread as we want it to stop is the main thread stops
                   //ss.setDaemon(true);
                   m_serverSocket = new ServerSocket(PORT);
              catch (IOException ex)
                   ex.printStackTrace();
         public void run()
              try
                   while (true)
                        // Launch a handler when a client connects:
                        final Socket clientSocket = m_serverSocket.accept();
                        ClientHandler clientHandler = new ClientHandler(clientSocket);
                        System.out.println("(Client " + clientHandler.getClientHostname() + " accepted on port " + PORT + ")");
                        clientHandler.start();
              catch (IOException ex)
                   ex.printStackTrace();
         private class ClientHandler extends Thread
              ClientHandler(Socket clientSocket)
                   try
                        setDaemon(true);
                        m_clientSocket = clientSocket;
                        m_socketWriter = new PrintWriter(new BufferedOutputStream(m_clientSocket.getOutputStream()));
                        m_socketReader = new BufferedReader(new InputStreamReader(m_clientSocket.getInputStream()));
                   catch (IOException ex)
                        ex.printStackTrace();
              public void run()
                   try
                        //m_socketWriter.println(getAlarmSummaryString());
                        //m_socketWriter.flush();
                        while (true)
                             final String request = m_socketReader.readLine();
                             System.out.println("Client request: " + request);
                             if (request.equals(REQUEST))
                                  m_socketWriter.println("RESPONSE");
                                  m_socketWriter.flush();
                             else
                                  m_clientSocket.close();
                                  break;
                   catch (SocketException ex)
                        System.out.println("(Client " + getClientHostname() + " disconnected)");
                   catch (IOException ex)
                        ex.printStackTrace();
              private String getClientHostname()
                   return ((InetSocketAddress)m_clientSocket.getRemoteSocketAddress()).getHostName();
              private Socket m_clientSocket;
              private PrintWriter m_socketWriter;
              private BufferedReader m_socketReader;
         private ServerSocket m_serverSocket;
    }

  • Java Chat, server/client*x

    Hey,
    I'm trying to make a chat and I've made the server and client, and the server can accept several clients. Only; they communicate client-server, and not client-server-client (if you get what I mean) like I want them to, pretty obviously, since its a chat. I'm still very new to this, heres my code anyhow:
    Server
    import java.net.*;
    import java.io.*;
    public class OJChatServer{
         public static void main(String[] args) throws IOException{
              int port=2556;
              boolean listening = true;
              ServerSocket cServerSocket = null;
              try{
                   cServerSocket = new ServerSocket(port);
                   System.out.println("Server started; Waiting for client(s) to connect.");
              } catch(IOException e){
                   System.err.println("Could not listen on port: "+port);
                   System.exit(1);
              while(listening){
                   try{
                        new handleClient(cServerSocket.accept()).start();
                   } catch(IOException e){
                        System.err.println("Accept has failed");
                        System.exit(1);
              cServerSocket.close();
         static class handleClient extends Thread{
              private Socket clientSocket = null;
              private PrintWriter send;
              private BufferedReader recieve;
              private String inputString, outputString;
              private String clientName = "";
              public handleClient(Socket acceptedSocket){
                   //super("handleClient");
                   this.clientSocket = acceptedSocket;
              public void run(){
                   try{
                        recieve = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
                        send = new PrintWriter(clientSocket.getOutputStream(), true);
                        inputString = recieve.readLine();
                        clientName = inputString;
                        System.out.println("Client \""+clientName+"\" has connected. ("+clientSocket+")");
                        while(inputString != null){
                             outputString = processInput(inputString);
                        //     outputString = send.readLine();
                             send.println(outputString);
                             if(inputString.equalsIgnoreCase("Quit")||inputString.equalsIgnoreCase("/Quit")) break;
                             inputString = recieve.readLine();
                        System.out.println("Client \""+clientName+"\" has disconnected. ("+clientSocket+")");
                   send.close();
                   recieve.close();
                   clientSocket.close();
                   } catch(IOException e){
                        //e.printStackTrace();
                        System.out.println("Client \""+clientName+"\" has disconnected. ("+clientSocket+")");
              }//run()
              static String processInput(String theInput){
                   String theOutput = "From server. Test";
                   return theOutput;
         }//handleClient
    }//OJChatServer---------------------------------------------------------------------------------------------
    Client
    import java.net.*;
    import java.io.*;
    public class OJChatClient{
         public static void main(String[] args) throws IOException{
              String nickname = "Guest";
              String host = "localhost";
              int port = 2556;
              Socket cClientSocket = null;
              PrintWriter send = null;
              BufferedReader recieve = null;
              BufferedReader stdIn = null;
              String fromServer, fromUser;
              System.out.println("Welcome to Ove's Java Chat!\nFor help and commands type: /help");
              nickname = KeyboardReader.readString("Enter nickname: ");
              System.out.println("Connecting to host...");
              try{
                   cClientSocket = new Socket(host, port);
                   send = new PrintWriter(cClientSocket.getOutputStream(), true);
                   System.out.println("Connection established.");
              } catch(UnknownHostException e){
                   System.err.println("Unknown host: "+host);
                   System.exit(1);
              } catch(IOException e){
                   System.err.println("Couldn't get I/O for connection: "+host+"\nRequested host may not exist or server is not started");
                   System.exit(1);
              send.println(nickname);
              stdIn = new BufferedReader(new InputStreamReader(System.in));
              recieve = new BufferedReader(new InputStreamReader(cClientSocket.getInputStream()));
              while((fromServer = recieve.readLine())!=null){
                   System.out.println("Server: "+fromServer);
                   fromUser = stdIn.readLine();
                   if(fromUser!=null){
                        //System.out.println(nickname+": "+fromUser);
                        send.println(fromUser);
                   if(fromUser.equalsIgnoreCase("Quit")||fromUser.equalsIgnoreCase("/Quit")) break;
              System.out.println("Closing connection...");
              send.close();
              recieve.close();
              stdIn.close();
              cClientSocket.close();
              System.out.println("Connection terminated.");
              System.out.println("Goodbye and happy christmas!");
    }I want to make it graphical too, but I want to make it work like it should, before i tackle trying Swing out. This code isn't completely complete yet, as you can see. It doesn't handle the clients messages correctly yet.
    What I want to know is how i should send a message from a client to all the other Sockets on the server.

    It compiles, but it gives an error when the client connects.
    import java.net.*;
    import java.io.*;
    public class OJChatServer4{
         static Socket[] clientSockets = new Socket[100];
         static int socketCounter = 0;
         public static void main(String[] args) throws IOException{
              int port=2556;
              boolean listening = true;
              ServerSocket cServerSocket = null;
              try{
                   cServerSocket = new ServerSocket(port);
                   System.out.println("Server started; Waiting for client(s) to connect.");
              } catch(IOException e){
                   System.err.println("Could not listen on port: "+port);
                   System.exit(1);
              while(listening){
                   try{
                        clientSockets[socketCounter] = cServerSocket.accept();
                        new handleClient(clientSockets[socketCounter]).start();
                        socketCounter++;
                   } catch(IOException e){
                        System.err.println("Accept has failed");
                        System.exit(1);
              cServerSocket.close();
         static class handleClient extends Thread{
              private Socket clientSocket = null;
              public static PrintWriter send;
              private BufferedReader recieve;
              private String inputString, outputString;
              private String clientName = "";
              public handleClient(Socket acceptedSocket){
                   //super("handleClient");
                   this.clientSocket = acceptedSocket;
              public void run(){
                   try{
                        recieve = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
                        send = new PrintWriter(clientSocket.getOutputStream(), true);
                        inputString = recieve.readLine();
                        clientName = inputString;
                        System.out.println("Client \""+clientName+"\" has connected. ("+clientSocket+")");
                        while(inputString != null){
                             //outputString =
                             processInput(inputString);
                        //     outputString = send.readLine();
                             send.println(outputString);
                             if(inputString.equalsIgnoreCase("Quit")||inputString.equalsIgnoreCase("/Quit")) break;
                             inputString = recieve.readLine();
                        System.out.println("Client \""+clientName+"\" has disconnected. ("+clientSocket+")");
                   send.close();
                   recieve.close();
                   clientSocket.close();
                   } catch(IOException e){
                        //e.printStackTrace();
                        System.out.println("Client \""+clientName+"\" has disconnected. ("+clientSocket+")");
              }//run()
              static void processInput(String theInput) throws IOException{
                   //String theOutput = "Test From server.";
                   PrintWriter sendToAll;
                   sendToAll = new PrintWriter(clientSockets[socketCounter].getOutputStream(), true);
                   for(int i=0;i<socketCounter;i++){
                        sendToAll.println(theInput);
                   //return theOutput;
         }//handleClient
    }//OJChatServer

  • Soap : java server / Vb client ?

    what kind of problems can occur if i develop an application based on soap protocol with a VB client and java server ( apache server web) ?

    Hi,
    Have u found any solution..???
    if yes please help me ..
    am trying for an application which can communicate over net between
    Solaris and Win NT. I am thinking of using SOAP for this communication.
    Solaris is going to post SOAP envelops using Java and WinNT is going to
    read these envelops using VB.
    but i want this communication to be secure.
    so, i would like to know
    1. Is SOAP the right technology for this
    2. Can SOAP envelops be made secure
    3. Do u have any other solution for this
    4. Can i send a entire file as an attachment/text with xml
    5. PLEASE : Can u provide me with sample code
    Kind regards
    Sachin

  • Invoking a BPEL Process via Java Remote Client

    Hi everyone!
    I want to invoke a BPEL process from my Java Application which is not running on the same Application-Server (not the same Java RE) as the BPEL processmanager does.
    For Applications running on the same AS there is the IDeliveryService class to which you can send a XML-request in order to invoke a BPEL process.
    Is the only way to invoke a BPEL Process from an external application to use a webservice client or is there a similar class for java remote clients?
    For access to the users worklist I use
    IWorkflowServiceClient wfClient = WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.REMOTE_CLIENT);
    it works fine an I thought there might be a similar way to invoke a bpel process via remote too.
    If anyone knows if it's possible or not please tell me ;)
    Thanks in advance
    Markus

    Hello,
    Here is the code I use:
    Properties props = new Properties();
    Locator locator = null;
    props.put("orabpel.platform", "ias_10g" );
    props.put("java.naming.factory.initial","com.evermind.server.rmi.RMIInitialContextFactory" );
    props.put("java.naming.provider.url","opmn:ormi://host:port/orabpel" );
    props.put("java.naming.security.principal", "adminuser" );
    props.put("java.naming.security.credentials", "mdp" );
    String securityCredentials = "adminuser";
    String selectedDomain = "default";
    locator = new Locator(selectedDomain,securityCredentials,props);
    IBPELProcessHandle procs[] = locator.listProcesses();
    The error is:
    Exception in thread "main" java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.oracle.bpel.client.BPELProcessHandle; local class incompatible: stream classdesc serialVersionUID = 5429682712928177644, local class serialVersionUID = 8176841433835717563
    at com.oracle.bpel.client.util.ExceptionUtils.handleServerException(ExceptionUtils.java:82)
    at com.oracle.bpel.client.Locator.listProcesses(Locator.java:309)
    Thanks for help.
    Edited by: 857737 on 14 sept. 2012 10:00

Maybe you are looking for