Client server http application

I must realize a client server application which comunicate using http protocol. The client asks for the hour and the server answer to it. It's necessary for testing our network. Which classes I must use? HttpURLConnection is suitable for this tipe of application?
Thank you...

you can probably use HttpConnection or HttpURLConnection.
i'm not too sure though.
if you run into security problems then you will probably have to use a servlet.
hope this helps
Andy

Similar Messages

  • A client-server authentication application

    Hello group,
    I want to develop an application which after a client gives
    username and password , the server will check about it if the
    client is registered or not. I have already developed an
    application which is stand alone and checks user validity using my
    mysql database, but no server is yet there.I have done a lot search
    in finding some tutorial about how to develop a client-server
    applicaion in flash.......but i didn' get anything.
    Pls. help me regarding this.
    Nehal Sheth.

    Ohh... so I'm not the only one with the same problem!! I'm also trying to do JMS + Wireless applications. I bet you've checked this: http://www.softwired-inc.com/people/maffeis/why_wjms.html . Have u? anyway, I'm trying to develop a small application in which you can subscribe and get notifications in your mobile whenever something related to your profile changes. Of course, using JMS, don't know where yet :-). Did you find out anything? i'd really appreciate if you can help me... where to start from...
    thanks
    andres

  • Best practice for client-server(Socket) application

    I want to build a client-server application
    1) On startup.. client creates connection to Server and keeps reading data from server
    2) Server keeps on sending different messages
    3) Based on messages(Async) from server client view has to be changed
    I tried different cases ended up facing IllegalStateChangeException while updating GUI
    So what is the best way to do this?
    Please give a working example .
    Thanks,
    Vijay
    Edited by: 844427 on Jan 12, 2012 12:15 AM
    Edited by: 844427 on Jan 12, 2012 12:16 AM

    Hi EJP,
    Thanks for the suggestion ,
    Here is sample code :
    public class Lobby implements LobbyModelsChangeListener{
        Stage stage;
        ListView<String> listView;
        ObservableList ol;
         public Lobby(Stage primaryStage) {
            stage = primaryStage;
               ProxyServer.startReadFromServer();//Connects to Socket Server
             ProxyServer.addLobbyModelChangeListener(this);//So that any data from server is fetched to Lobby
            init();
        private void init() {
              ProxyServer.getLobbyList();//Send
            ol = FXCollections.observableArrayList(
              "Loading Data..."
            ol.addListener(new ListChangeListener(){
                @Override
                public void onChanged(Change change) {
                    listView.setItems(ol);
         Group root = new Group();
        stage.setScene(new Scene(root));
         listView = new ListView<String>();
        listView.maxWidth(stage.getWidth());
         listView.setItems(ol);
         listView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
        istView.setOnMouseClicked(new EventHandler<MouseEvent>(){
                @Override
                public void handle(MouseEvent t) {
    //                ListView lv = (ListView) t.getSource();
                    new NewPage(stage);
         root.getChildren().add(listView);
         @Override
        public void updateLobby(LobbyListModel[] changes) {
    //        listView.getItems().clear();
            String[] ar = new String[changes.length];
            for(int i=0;i<changes.length;i++)
                if(changes!=null)
    System.out.println(changes[i].getName());
    ar[i] = changes[i].getName();
    ol.addAll(ar);
    ProxyServer.javaProxyServer
    //Implements runnable
    public void run()
         ......//code to read data from server
    //make array of LobbyListModel[] ltm based on data from server
         fireLobbyModelChangeEvent(ltm);
    void addLobbyModelChangeListener(LobbyModelsChangeListener aThis) {
    this.lobbyModelsChangeListener = aThis;
         private void fireLobbyModelChangeEvent(LobbyListModel[] changes) {
    LobbyModelsChangeListener listner
    = (LobbyModelsChangeListener) lobbyModelsChangeListener;
    listner.updateLobby(changes);
    Exception :
    java.lang.IllegalStateException: Not on FX application thread; currentThread = Thread-5
             at line         ol.addAll(ar);
    But ListView is getting updated with new data...so not sure if its right way to proceed...
    Thanks,
    Vijay                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Client-server database application...

    Hi there!
    I'm about to write a database-application and I wonder if the following approach is to prefer or not:
    I want to use a MySQL-database and there shall be about eight client-applications which all shall be able to use it. I think of solving the above with RMI (I want to create/deploy a server wich will contain all the different SQL-queries on the same site as where I install the MySQL-database ). From the clients I just, with RMI, invoce the methods on the server which contains the different queries I want to use. In other words all the database-functionality is located on the server somewhat like stored procedures. To make it work each client must be assigned a thread of its own on the server...is this right?
    The advantages of the above which I can think of is: I just need to stuff one J/Connector driver in the JRE (on the server). Another is that I can use the nameservice of RMI... are there others?
    Is the above a good / usual or even bad approach?
    Is it more usual or even better to just provide the database-functionality (SQL-queries) in the clients and provide every client with the J/Connector driver?
    Thanks in advance!

    You noted that there will be "eight client-applications" - does that refer to eight users or eight programs using the database? This is important in determining your course of action.
    If you're talking about a small number of concurrent users (you have to define small), then you'll probably better off trying to do all the data/business logic in the app. If you're talking about a large number of concurrent users (again, your definition), your client/server paradigm might be better.
    To complicate things, unless you're doing this as a learning-on-your-own project (e.g. not getting paid for it), this is where you might want to evaluate using J2EE technoligies for your server-side implementation. Writing your own server is not a trivial task (been there, done that - pre-J2EE, of course): there's a lot of things you have to figure out how to handle. Well, that's true of even using J2EE, but there's some portion of what your server would need to do already taken care of in an application server.

  • Authentication in Client/Server form Application

    Hi
    My client/server application is not using oracle authentiacation, I have maintained user table from that user is authenticated, but any user logins in a application it uses same oracle username/PWD which I currently hardcoded in a forms 6i (C/S type on logon event) application.
    My client is located in different geographicaly location, when I change oracle database password I need to compile client application and diployed it again.
    Is there any way that I can avoid this. I don't want to give database Un/Pwd to any client user. He only have application username and password.
    Thanks
    Sudarshan

    Hello,
    While installing developer you can select components to
    Install, Options listed are Forms runtime and Reports runtime.
    and it will make your work done.
    Adi

  • Client/server/web application

    My application will be deployed as client/server application and as well as web application. An database is used to keep the persistent data.
    For the client/server environment, I will need client tier, application server tier, and the database tier. For the web applicaiton, I will need web interface, web server, and the database tier.
    My question is that since the application will be deployed as both client/server application and web application, how to leverage the components, so the application server and the web server has less code duplication.
    Is there any guideline for designing such an architecture?
    The application uses J2SE, and Tomcat is the servlet engine.
    Thanks for any input /danclemson

    Your business logic should be written so that it can used from anywhere. Command line, GUI, webapp, it's irrelevant. Likewise with the db layer, so those will be exactly the same. Then you just put whatever front end you want on it. Now, if you're talking about having the same server used for both at the same time, that's a different question. But it sounds like you're asking about code.

  • Client/Server to Web-Based application Conversion

    Hi! Everyone,
    I have couple of questions for you guys.
    Our Client had recently upgraded Forms 4.5 to 6i to move from Client/Server based application to Web based application.
    They are using Forms Server 6i Patch Set 1, OAS 4.0.8.1, Windows NT Service Pack 5 and Oracle 7.3. They are facing the following error every now and then, when they run the forms,
    "FRM-92100: Your connection to the server was interrupted. This may be the result of a network error or a failure on the server.You will need to re-establish your session."
    Please let me know what might be causing the above error. The only problem i can think about might be Oracle 7.3. If i am right only Oracle 8 and above supports Forms 6i.
    Can anyone let me know some tips and/or techniques to upgrade Forms 4.5 to 6i. If there are any important settings/steps which we might have over looked during the upgrade, please list them.
    Any kind of help is greatly appreciated.
    Thanks,
    Jeevan Kallem
    [email protected]

    Most of the code is use with no changes at all.
    See otn.oracle.com/formsupgrade
    Regards
    Grant Ronald

  • Need help in desigining Client/Server Application using Java

    Hi,
    I am new to Java and no sooner that I started studing it I have been given a project - client server java Application that allows a user to do a property search based on critiras (eg location, price) and display the results. I am stuck because I don't know where I need to start. Have to use IDE (Netbeans or Eclipse) but not sure about dev frameworks.
    Can someone give me an outline of what I should do / where I should start? What will be the best solution?
    Thanks in adance

    http://java.sun.com/docs/books/tutorial/networking/index.html
    That's Sun's networking tutorial series. Live it, learn it, love it. You'll need to decide if you want to use connected sockets or datagrams. You'll need details like, can multiple clients connect simultaneously?
    The tutorials are the first step though.

  • Client/server application under development

    Hi there,
    I've been working on a client/server application that includes chat and whiteboard features. In terms of how the client app communicates with the server app, my initial thought was to just go with xml, until I reached a snag. Everything about chat and almost everything that is accomplished on the whiteboard can be expressed in terms of text or character data; which what makes xml a good candidate for moving the data back and forth from client to server. However, there's one part of the whiteboard feature that can't be converted to just text. The whiteboard has an ImageTool. With it you can select an image (gif,jpg) from your harddrive and load it into the whiteboard. An image is binary data and simply cannot be put into an xml file for transport. At least, that's my understanding. Am I wrong about this?
    So, this poses the questions: "How do other similar applications like MSN Messenger move images around? If they're not using xml as there medium, what are they using? Just plain sockets without any structured medium like xml?"
    Please advise,
    Alan

    You could always Base64 encode the image file content and then put the Base64 in XML.
    I am in the middle of a client-server project and I use XStream ( http://xstream.codehaus.org/ ) to convert Objects to XML automatically. I don't have to do any explicit encoding - XStream does it all for me.

  • Client/server socket based application

    hi does anyone have example of client/server socket based application using Spring and Maven
    where application do the following
    Client sends a request with a path to any file on the server
    „h Server reads the file and responds back with the content
    „h Client outputs the content to the console
    am trying to follow this
    http://www2.sys-con.com/itsg/virtualcd/java/archives/0205/dibella/index.html
    http://syntx.io/a-client-server-application-using-socket-programming-in-java/
    am using java 6

    i have attempt code but i wht to do the following
    client/server socket based application that will read the content of a file and stream the content of the file to the client. The client must simply output the content of the file to the console using System.out. The client must be able to run in a standalone mode (non-network mode) or in a remote mode.
    Additionally the client must be designed in a way that i can print the output to a console but must be interchangeable where if requirements change i can persist the response to file or persist the response to a database.
    /* Server.java*/
    ///ifgetBoolen= true then...
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.sql.*;
    public class Server
        static String array[][];
        // STEP 1 a1  
        // Server socket
        ServerSocket listener;
        // STEP 1 a2 Client connection
        Socket client;
        ObjectInputStream in;
        ObjectOutputStream out;
        public void createConnection() throws IOException
                System.out.println("\nSERVER >>> Waiting for connection.....");
                client = listener.accept();
                String IPAddress = "" + client.getInetAddress();
                DisplayMessage("SERVER >>> Connected to " + IPAddress.substring(1,IPAddress.length()));
          public void runServer()
            // Start listening for client connections
            // STEP 2
            try
                listener = new ServerSocket(12345, 10);
                createConnection();
                  // STEP 3
    //              processConnection();
            catch(IOException ioe)
                DisplayMessage("SERVER >>> Error trying to listen: " + ioe.getMessage());
        private void closeConnection()
            DisplayMessage("SERVER >>> Terminating connections");
            try
                if(out != null && in != null)
                      out.close();
                    in.close();
                    client.close();                
            catch(IOException ioe)
                DisplayMessage("SERVER >>> Closing connections");
        public static void define2DArray(ResultSet RS, int Size)
            try
                ResultSetMetaData RMSD = RS.getMetaData();
                DisplayMessage("SERVER >>> Requested arraySize: " + Size);
                if (RS.next())
                    array = new String[Size][RMSD.getColumnCount()];
                    for (int Row = 0; Row < Size; Row++)
                        for (int Col = 0; Col < RMSD.getColumnCount(); Col++)
                            array[Row][Col] = new String();
                            array[Row][Col] = RS.getString(Col+1);
                            DisplayMessage(array[Row][Col] + " ");
                        RS.next();
                else
                    array = new String[1][1];
                    array[0][0] = "#No Records";
            catch (Exception e)
                DisplayMessage("SERVER >>> Error in defining a 2DArray: " + e.getMessage());  
        public static void DisplayMessage(final String IncomingSMS)
            System.out.println(IncomingSMS);
    //client
    * @author
    import java.io.*;
    import java.net.*;
    import javax.swing.*;
    public class ClientSystem
        static Socket server;
        static ObjectOutputStream out;
        static ObjectInputStream in;
        static String Response[][];
        static boolean IsConnected = false;
        static int Num = 0;
        public static void connectToServer() throws IOException
            server = new Socket("127.0.0.1", 12345);
    //        server = new Socket("000.00.98.00", 12345);
            String IPAddress = "" + server.getInetAddress();
            DisplayMessage("\nCLIENT >>> Connected to " + IPAddress.substring(1,IPAddress.length()));
        public static void getStreams() throws IOException
            out = new ObjectOutputStream(server.getOutputStream());
            out.flush();
              in = new ObjectInputStream(server.getInputStream());
              IsConnected = true;
              DisplayMessage("CLIENT >>> Got I/O streams");  
        public static void runClient()
            try
                connectToServer();
                getStreams();
                  DisplayMessage("CLIENT >>> Connection successfull....\n");
                  DisplayMessage("CLIENT >>> Want to talk to server");
            catch (IOException ioe)
                System.out.print("."+Num);
                Num++;
        public static void closeConnection()
            try
                out.close();
                in.close();
                server.close();  
            catch(IOException error)
                DisplayMessage("CLIENT >>> Could not close connections");
        public static void Start()
            System.out.print("\nCLIENT >>> Attempting connection.....");
            try
                IsConnected = false;
                while (IsConnected == false)
                    runClient();
                    if (IsConnected == false)
                        Thread.sleep(100);
            catch (Exception e)
                DisplayMessage("CLIENT >>> Attempting connection.....");
        public static String sendSMS(String sms)
            Response = new String[0][0];
            try
                DisplayMessage("CLIENT >>> " + sms);
                out.writeObject(sms);
                out.flush();
                Response = (String[][])in.readObject();
                DisplayMessage("CLIENT >>> Waiting for server to respond...");
                for (int Row = 0; Row < Response.length; Row++)
                    System.out.printf( "_SERVER >>> \t");
                    for (int Col = 0; Col < Response[Row].length; Col++)
                        //DisplayMessage( "_SERVER >>> " + Response[Row][Col] + " ");
                        System.out.printf( "%s\t", Response[Row][Col]);
                    System.out.println();
                DisplayMessage("CLIENT >>> Query processed successfully....\n");
            catch(ClassNotFoundException cnfe)
                DisplayMessage("CLIENT >>> Class not found for casting received object");
            catch(IOException ioe)
                reConnect();          
            catch (Exception sqle)
                DisplayMessage("CLIENT >>> Error sending query ??? " + sqle.getMessage());
            return "transmission successfull";
        public static void reConnect()
            try
                DisplayMessage("CLIENT >>> Connection was lost. Trying to reconnect...");
                closeConnection();
                Thread.sleep(100);
                IsConnected = false;
                while (IsConnected == false)
                    runClient();
                    Thread.sleep(200);
            catch (Exception e)
                DisplayMessage("CLIENT >>> Error trying to Re-Connect...");
        public static void DisplayMessage(final String IncomingSms)
            System.out.println(IncomingSms);
        System.out.printf("Isms: %s", IncomingSms);  ///naah.
        public static String[][] getResponse()
            return Response;
        public static String getResponse(int row, int col)
            return Response[row][col];
    how can i do below using above code
    The program must be able to work in a non-networked mode. In this mode, the server and client must run in the same VM and must perform no networking, must not use loopback networking i.e: no “localhost” or “127.0.0.1”, and must not involve the serialization of any objects when communicating between the client and server components.
    The operating mode is selected using the single command line argument that is permitted.
    imust use a socket connection and define a protocol. networking must be entirely bypassed in the non-network mode.

  • Are there any Client/Server Application (using sockets) design patterns?

    Hi,
    The title of the post nearly says it all. I am searching for different design patterns related with the development of a client/server application. I understand that there must be any different ways on how a client/server application can be developed.
    Regards,
    Sim085
    Disclaimer:
    When I enter in the Socket forum on this site I recieve this message "Thank you for any participation in this forum. Due to a lack of relevant activity, we have decided to archive this forum on June 16, 2006. For future posts on this topic, we suggest you use the Networking forum" and I am not allowed to create a new post! However I can see posts done yesterday! All i did is add the forum in 'my forums'. Does this happen to you people as well?

    Hi Sim085...How are you?
    So look this:
    http://forum.java.sun.com/thread.jspa?threadID=5148926&tstart=75
    I don�t know if is what you want...but I hope in this^^
    Ok man...If you have one example for help you is better.
    [ ]

  • How to dertermine size of a perticula Client in sap application server

    R/S all,
    Kindly guide me for "How to determine size (hard disk space) of a perticular client in SAP Application Server "

    Hi,
    Have a look at the [SAP Note 118823 - CC-ADMIN: Size of a client|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=118823].
    You can use the report RSSPACECHECK to check the size of SAP client. You can also use the test run option in client copy to determine the size os a client.
    Hope this helps.
    Regards,
    Varadharajan M

  • Client/server application using sockets

    Hi there,
    I'm trying to create a client/server application using sockets where the client has a GUI of a membership application form for some sort of club. Basically, the user will enter their name, address, membership no. etc in to various Jtext fields and then press a JButton to submit these details to the server. The server will then hopefully just dump these details to a text file.
    Can anyone give me any examples, ideas on how to start, links etc.
    Thanks v. much in anticipation,
    Nick

    Take a browse of the tutorial on sockets: http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html

  • Advanced Client Server Application

    Hi friends .I'm working on a client server project.In this project I must use two OBJECTOUTPUTSTREAM and OBJECTINPUTSTREAM.But in the program one of them lock the program.
    This code a part of from my code.
    input1 and input2 a ObjectInputStream.
    There are two serversocket in the server side.
    Client side got two socket and connected server's two sockets.
    Sockets had an objectoutputstream and an objectinputstream.
    This project about a game .But players can talk to each other.
    input1 send the game move to another player.
    input2 send the chat message to anoyher player.
    But program always wait the input1 after wait input2.As soon as one of the player moves or seend message another side must take it same time
    I can't do this.
    do{
    move=*this*.input1.read();
    // this wake for move and lock the program here.program doesn't go down.IT'IS A PROBLEM
    message=(String)*this*.inputi2.readObject();
    }*while*(!str.equalsIgnoreCase("Kapat"));
    I thought very much about it.I think I must use a thing lile listener whitch run as soon as objectoutput write to input.
    I'm waiting for your help.If you show a sample code about this subject I pleased very much.
    Good luck everone.Herkese iyi �anslar.this explanation isn'about code and it's my own language.
    T&Uuml;RK&Ccedil;E
    �nsan�n ana dili gibisi yok.Bu a&ccedil;�klamay� Ba�taki ingilizcede sonra yapt���m i&ccedil;in bu dili bu g&uuml;ne kadar geli�tirip gelen t&uuml;m t&uuml;rk milletinden &ouml;z&uuml;r diliyorum.Amac�m istedi�ime ula�mak ve bu siteyi ziyeret edenlerin % 99 ingilizce kulland��� i&ccedil;in b&ouml;yle yapmak zorunda kald�m.Kusuruma l&uuml;tfen bakmay�n.
    K�sace &ouml;zetlemek gerekirse uygulamamda Farkl� socketler &uuml;zerinden birbirine ba�l� 2 OBJECTINPUTSTREAM ve OBJECTOUTPUTSTREAM var
    bunlar�n ikisindende kar��l�kl� ver aktar�yorum .biri oyun hamlesi ta��mak di�eride mesaj ta��mak i&ccedil;in.Ama bunlardan biri program� blokluyor di�eride orogram inemiyor.Bu sorunu &ccedil;&ouml;zmeliyim.
    do{
    move=*this*.input1.read();
    // Hamleyi beklemeye ba�lad���zaman bir mesaj gelince buraya inmiyor illaki hamleyi bekliyor.
    //Hamle geldikten sonrada bu sefer mesaj� bekliyor hamleyi alm�yorr.Bu sorunu halletmem laz�m.
    message=(String)*this*.inputi2.readObject();
    }*while*(!str.equalsIgnoreCase("Kapat"));
    Listener gibi bir �ey kullan�rsam sorun &ccedil;z&uuml;l&uuml;r san�r�m.Yard�mc� olursan�z minnettar olurum.

    I'll go further than that. I'd say that these days, any time you have any kind of client/server application, the first question you should ask is, is there any pressing reason why we can't just use a web server for the server do all communication over HTTP using a textual serialization mechanism like XML and preferably using REST?
    The documentation and infrastructure for this stuff is so extensive these days, and the potential for repurposing is so great, that going any other way without a good reason is a waste of effort. Even if HTTP/REST/XML isn't an exact fit, it can still be worth it (at least for prototyping) just for the convenience.

  • Client/Server application question

    Hey everyone,
    I am trying to exercise on a client/server application. My client application is similar to this one [http://java.sun.com/developer/onlineTraining/Programming/BasicJava2/Code/SocketClient.java]. However this client works like this: it sends text through socket -> receive response from server. I am trying to find a way so that the client can receive and process messages from the server asynchronously. That is the server can send messages anytime (not just as a response to the client) and the client should always be able to receive messages from the served at any time, and not just after it sent something. I believe that multithreading would be the answer, listening to the output stream and sending through the input stream should be run in parallel, but I can't find a way to implement it. Your help is appreciated. Thank you.

    I knew that :-) but how exactly?
    How do I translate this code into two runnable classes which will communicate with the original class and its gui?
    //Send data over socket
              String text = textField.getText();
              out.println(text);
           textField.setText(new String(""));
    //Receive text from server
           try{
           String line = in.readLine();
              System.out.println("Text received :" + line);
           } catch (IOException e){
          System.out.println("Read failed");
                 System.exit(1);
      }

Maybe you are looking for

  • Internal speakers don't work

    My husband uses the dual USB late 2001 iBook more than I do, mainly with Toast and a Griffin iMic to copy our old vinyl records to CDs, and to run VirtualPC for his PC model railroad design app. He does all this in OS 9.2.2. I used the iBook yesterda

  • I installed the WRT54G Wireless router on my desktop and...

    I installed the WRT54G Wireless router on my desktop and have been using the internet on that pc and my laptop (wirelessly) for a few months.  Last week I uninstalled Norton Internet Security and installed ESET Smart Security.  Now my desktop cannot

  • Error 85 occurring for 4-digit numerical strings

    Hello,  I have a labview program that measures the current vs voltage for a field emission device. The problem that I'm having is I recive the error 85 message whenever my current measurment reaches 4 digits, for example, 1000 uA. I've read that the

  • .JPGs used in the drop/drag quiz questions

    In Captivate 4, can .JPGs be used in drop/drag quiz questions? We need to see if Learners can properly "build up" a sub-assembly of a machine and they will need to know which part fits on top of the correct piece of equipment. If not, any suggestions

  • Placing two Elements into one TextFrame

    Hi everybody, I am trying to place the content of one specific xml Elements: "//version/content" or "//content" is the xpath-expression. The element appears in different nodes (but always as last node). Is it possible to place both in the TextFrame,