Communication protocol applet and server application

Hello,
I want to read and write on server port such that applet is communicating with a server application.
Can any body suggest me any application level communication protocol or algo so that read and write are syncronised.
There is no blocking b/w I/o streams while clients are reading or writing to server.
shahzad

Look at this 3 pages
http://java.sun.com/docs/books/tutorial/networking/sockets/index.html
http://java.sun.com/products/javacomm/javadocs/API_users_guide.html
http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html
Noah

Similar Messages

  • Communication protocol between Admin Server and Managed Server

    Hello - I am hoping someone can help me here to understand the communication protocols used in my setup.
    Here is my understanding of the protocol that are used between each component.
    End User <--->HTTPS<--->LoadBalancer Device<--->HTTPS<--->Web Server<---->HTTPS<--->WebLogic Server(Managed Server)<--->LDAP/JDBC<-->Data tier components
    AdminServer<--->T3<--->Managed Server i.e. The communication protocol between Admin Server and Managed server is T3
    The communication protocol between Managed Servers running in one cluster on two seperate machine is What?
    Thank you.

    Hello, interesting question.
    In the documentation " [cluster multicast communication|http://download.oracle.com/docs/cd/E13222_01/wls/docs90/cluster/features.html#1007001] " don't specify the used protocol to pack the information for example in a session replication.
    Although in a session replication all objects must be serializable i don't think rmi protocol is used.
    I hope some expert give us some light in this issue :-)
    http://download.oracle.com/docs/cd/E13222_01/wls/docs90/cluster/features.html#1007001

  • Socket communication failure between Java applet and C++ application

    I have a java applet that connects to a C++ application via Java's ServerSocket and Socket objects. THe C++ application is using the Winsock 2 API. The applet and application are running on an NT workstation (SP 6) and using IE (5.5) For a very simple C++ test applications the communictions work fine. Once more code gets added to the C++ application the portion of the socket that C++ listens to seems to close. Upon performing a recv call the return value is a zero. Microsoft insists this is a sign the Java side has shut down the socket. The Java applet can still receive messages from the C++ app but C++ cannot receive responses from the Java side. Java throws no exceptions and an explicit check of the socket shows no errors. Again, what puzzles me is that it works for simple C++ applications. Are there any known conflicts between Java and C++ in this regard?
    I have inlcuded the basic java code segments below.
    / run Method.
      * This method is called by the Thread.start() method. This
      * method is required for the implementation of the Runnable interface
      * This method sets up the server side socket communication and
      * contiuously loops looking for requests from a external
      * socket.
      * @author Chris Duke
      public void run(){
         // create socket connections
         boolean success = false;
         try {
             cServerSocket = new ServerSocket(cPortID);
             System.out.println("Waiting for client to connect...");
             cClientSocket = cServerSocket.accept();
             System.out.println("Client connected");
             // Create a stream to read from the client
             cInStream = new BufferedReader(new InputStreamReader(
               cClientSocket.getInputStream()));
             // Create a stream to write to the client       
             cOutStream = new PrintWriter(
               cClientSocket.getOutputStream(), true);
             success = true;
         }catch (IOException e) {
             System.out.println("CommSocket:Run - Socket Exception(1) " + e);
             success = false;
         // if the socket was successfully created, keep the thread running
         while (success){
             try{
                // check socket to see if it is still available for reading
                if (cInStream != null && cInStream.ready()){
                    // check for an incoming message
                    String message = ReceiveMessage();
                    // Send message to listeners
                    Event(message);
                if (cInStream == null){
                    success = false;
                    System.out.println("CommSocket:Run - shutdown");
             }catch (IOException e){
                System.out.println("CommSocket:Run - Socket not ready exception");
                break;
    // SendMessage method -
      *  Sends a text message to a connected listener through port specified by portID
      * @author Chris Duke
      * @param  String message - This will be the message sent out through the server
      * socket's port specified by portID.
       public void SendMessage(String message){
          cOutStream.println(message);
          if (cOutStream.checkError() == true)
            System.out.println("SendMessage : Flush = Error");
          else{
            System.out.println("SendMessage : Flush - No Error");
       }

    a very simple C++ test applications the communictions work fine. Once more code gets added to the C++ application the portion of the socket that C++ listens to seems to close.
    This quite strongly implicates the extra code in the C++ App. The firstly thing I would try would be telnet. Try connecting to both versions of the C++ Application and manually reproducing a proper exchange.
    a recv call the return value is a zero. Microsoft insists this is a sign the Java side has shut down the socket.
    A correct implementation of recv should return the number of bytes received, or -1 for an error. A zero return indicates no bytes received not a socket closed/error. This sounds like FUD to me.
    Are there any known conflicts between Java and C++ in this regard?
    I can see no obvious faults, though the code is incomplete, I don't think it's an sockets implementation issue, at either end, it sounds more likely to be a protocol/handshaking bug in the C++ App.

  • Communication between client and server

    I am using sockets for communication between the client and the server. is there any other way that i can use for communication between the client and server???

    Plenty of ways: JMS, SOAP, RMI, a RESTful API, writing-files-to-a-shared-directory-on-the-disk, Sneakernet, ...
    Some of them use sockets (or better TCP/IP) as the underlying protocol.
    But to give you a good answer, you would have to tell us why you want a different way. I hope you're not searching for a different way just for the sake of being different.

  • Socket communication between client and server

    Hi all,
    I am doing an assignment for communication between java client and java server using sockets. This communication is in the form of XML documents. I am facing a problem in this communication.
    Actually at Server side I'm creating an XML document(Document type object) using DocumentBuilderFactory in javax.xml.parsers package and transforming this Document into a stream using StreamResult.
    My code is :
    Transformer xmlTransformer = TransformerFactory.newInstance().newTransformer();
    StreamResult xmlString = new StreamResult(currentClientHandler.getSocketOutputStream());
    DOMSource xmlDocSource = new DOMSource(xmlDocument); // xmlDocument is Document type reference
    xmlTransformer.transform(xmlDocSource, xmlString);
    so, this xmlString(i.e. StreamResult) is passed directly into the output stream. Here I need to close() output stream after transform() call to help SAX parser to know about end of stream.
    Now at Client side, I am parsing this stream using SAX parser. It parses this correctly. But when sending some another data back to Server when client opens output stream, it given Socket closed exception. I know that closing input or output stream closes socket. But in my problem, I have to send data in streams and not by using files or byte[] etc.
    So what is nearest solution to problem ??
    Plz help me. Any kind of help will be greatly appreciated.

    hi
    thanks for ur reply.
    I didnt get any error msg while getting the back the datas.
    Actually i divided my application into two parts.
    My application will act as both server and client.
    server ll get the browser request and send to the client and the client will send that data to the c++ server.
    Im able to do that.and unable to get the data from server.
    Didnt get any error.
    can u tell me how to make an application to act as both client and server.
    I think im wrong in that part.
    thanks a lot

  • Socket communication between applet and an AP on simulastor

    Hi!
    I implemented my system under Server/Client model.
    The server is running in a Set-Top-Box simulator, which
    creates a ServerSocket on port 9190.
    The client is an applet and using the following codes to connect to server:
    ==========================================
    Socket socket = new Socket("127.0.0.1", 9190)
    InputStream in = socket.getInputStream();
    OutputStream out = socket.getOutputStream();
    ==========================================
    When I start the applet, no exceptions are thrown,
    and objects socket, in and out are not null.
    But when I was trying to send a string to server,
    ==========================================
    out.write("a string".getBytes());
    ==========================================
    nothing happened. Server didn't get anything.
    What's wrong? How can I solve this?

    First of all "nothing happend" is something you tell the DELL helpdesk.
    This is a developer forum.
    My guess is you are using somthing of a in.readLine() on the server and since the
    client doesn't sent a linebreak it will hang there.
    Or the client gets an AccessControlException that you silently catch and therefore get
    no exception. Allthough the InputStream would be declared in the try block (according
    to posted code) and can not be checked for beeing null in the catch (out of scope).
    Here is some sample code of client and server, try to implement the run method in
    your client and run both appTest and applet on the local machine (http://127.0.0.1).
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.net.ServerSocket;
    import java.net.Socket;
    public class appTest implements Runnable {
         public appTest() {
              new listner().start();
              new Thread(this).start();
         // main program
         public static void main(String argv[]) throws Exception {
              new appTest();
         public void run() {
              // the client
              try {
                   Socket s = new Socket("127.0.0.1", 9190);
                   // if multiple messages are to be sent and received
                   // this is where you start a new thread
                   byte b[];
                   OutputStream out = s.getOutputStream();
                   InputStream in = s.getInputStream();
                   String message = "hello from client";
                   int messageLength = message.getBytes().length;
                   // writing the length of the message
                   out.write(new Integer(messageLength).byteValue());
                   b = message.getBytes();
                   // writing the message
                   out.write(b);
                   // reading the length of the message and setting the byte array to
                   // it
                   b = new byte[in.read()];
                   in.read(b);
                   // receiving the message
                   System.out
                             .println("received massage from server: " + new String(b));
                   out.close();
                   in.close();
              } catch (Exception e) {
                   e.printStackTrace();
         class listner extends Thread {
              public void run() {
                   try {
                        ServerSocket srv = new ServerSocket(9190);
                        while (true) {
                             try {
                                  System.out.println("before accepting a client");
                                  Socket s = srv.accept();
                                  System.out.println("after accepting a client");
                                  // if multiple messages are to be sent and received
                                  // this is where you start a new thread
                                  byte b[];
                                  OutputStream out = s.getOutputStream();
                                  InputStream in = s.getInputStream();
                                  // reading the length of the message and setting the
                                  // byte array to
                                  // it
                                  b = new byte[in.read()];
                                  in.read(b);
                                  // receiving the message
                                  System.out.println("received massage from client:"
                                            + new String(b));
                                  System.out.println("sending message from server:");
                                  String message = "hello from server";
                                  int messageLength = message.getBytes().length;
                                  // writing the length of the message
                                  out.write(new Integer(messageLength).byteValue());
                                  b = message.getBytes();
                                  // writing the message
                                  out.write(b);
                                  out.close();
                                  in.close();
                             } catch (Exception ex) {
                                  ex.printStackTrace();
                   } catch (Exception e) {
                        e.printStackTrace();
    }

  • What's the difference between the Application Developer Tools and Server Applications CD

    I have 2 questions about Sql Server 2005.
    1.  I have 2 sets of CDs, one is called Sql Server 2005 Developer Edition, Applications Developer Tools, and another one called Sql Server 2005 Developer Edition Servers Server Applications.
    I installed the Applications Developer Tools on my development pc, and I was able to use create and populate a database, and use Sql Server Management Studio fine. I wonders what 's the Servers Server Applications set of cds for.
    2.  I just like to install Sql Server 2005 on a test pc also.  Can I use my Developer Edition Applications Developer Tools to install it ?
    Thanks.

    Bathoi,
    Is this still an issue?
    Thank you!
    Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • Communication between applet and Web app (IE6 works IE7 doesn't)

    I'm not 100% sure this is the correct forum to post this in, but as the communication is initiated from the applet I'm posting it here.
    I have an applet that we are slowly breaking pieces out of into a web app.
    The details are as follows.
    The applet calls a servlet on the webserver with the following code.
    URL url = new URL("http://.................");
    ServletMessage message = new ServletMessage(url);
    InputStream returnStream = message.sendPostMessage(sending);The servlet takes the user credentials and other info that was sent and authenticates the user and stores the info that was passed into the session on the web server. Then based on the users permissions and where they want to go in the web app the servlets redirect method calls
    resp.getOutputStream().print("/AppName/appropriateServlet");This sends control back to the applet (including the url of the servlet that needs to be called) which then calls the appropriate servlet
    container.getAppletContext().showDocument(new URL("http://.............." + returnURL), "Title");Now the problem is that in the first and second servlet the request.getSession() returns two different sessions when running under IE7. IE6 returns reference to the same session.
    I don't know what has changed in IE7 but I was hoping somebody else has run into this, or can suggest a more appropriate forum to post this to?
    Thanks

    So the solution I came up with was when the applet jumps to the web app the first time instead of storing everything in session I store them in a map in the servletContext under their employee number.
    I then send control back to the applet with the url they should call. When the applet calls the web app for the second time it includes their employee number as parameter in the url.
    A Login filter then first checks to make sure it isn't on the first call, and checks to make sure they aren't in session... if so it pulls the map out of servletContext and transfers all the data back to the session and clears that user out of servletContext.
    So it stores the user in the servletContext during the transfer back and forth, then back in session like normal.
    I'm pretty sure it is going to work, but I can't test it because our mainframe test region is down which is what handles the authentication of the applet.

  • Applets and server scripts

    Hi,
    I'm trying to run a java applet with a web application I'm developing, but I'm having some trouble running it.
    I have a dll which generates html pages dynamically, and in one of the pages i want to call an applet, but I keep getting an error that the class cannot be found.
    running this on a personal webserver, I have my scripts in the "inetpub/scripts" directory, and I've tried putting my packages under the scripts sub directory, and in the wwwroot directory, as well as the inetput directory, but i still get the error.
    in the applet tag, I have <applet code=package.classname.class ...>
    i have also created the html page on its own, as a seperate html file, and the page works.. i only get the error when the .dll is generating the html page.
    any help would be much appreciated.
    thanks!
    dtudino.

    When you pull up one of you DLL pages in your browser, you get some URL like
    http://www.somedomain.com/somepath/Generated.html
    If your <applet> tag has no codebase parameter, it expects the applet to be in
    http://www.somedomain.com/somepath/package/classname.class
    There could be a couple of problems here. First, maybe your HTML generator has the directory security set so that nothing can be served directly from it.
    Try using the codebase parameter of the <Applet> tag
    <applet code="package.classname.class" codebase="http://www.somedomain.com/someotherpath" ...>
    I don't like to use absolute paths in <applet> tags, but it will work for debugging.
    Next, if you are using a jar file, you need to have an archive parameter in your <applet> tag.

  • Data Communication between flash and different applications

    Is there a way to communicate between two different
    standalone applications, without using a HTTP server ?
    for eg: from Flash to JVM

    hi,
    I want to communicate between flash exe and director exe
    using local
    connection object. Can anybody help me in this, by telling
    the code for it. I
    tried a lot using it by different ways but I am not succesful
    in it yet
    Thanx in advance
    ANSWER :
    you should make an action script to the animation & etc.
    you made in your FLASH by a name as like as this : (I made a pause
    Button & named it gPause);
    on (release) {
    getURL("event:gPause");
    and then in youe director file make a MovieScript including
    the following code :
    on startMovie
    member("name of member you imported from Flash as swf. file
    ").model("Bip01").bonesplayer.pause()
    end
    on gPause
    member("name of member you imported from Flash as swf. file
    ").model("Bip01").bonesplayer.pause()
    end

  • CCP Communication Protocol - SSH and HTTPS

    Hi Gurus,
    Do we need to enable HTTPS and SSH both on device, to enable access from CCP? Or only SSH would be enough?
    Best Regards,
    Ahmed Shahzad.

    Hi Ahmed,
         For CCP to discover a device you need to have HHTP or HTTPS configured on the device as well as SSH.  Refer to - http://www.cisco.com/en/US/docs/net_mgmt/cisco_configuration_professional/v2_4/guides/getting_start/creatcom.html#wp1057296 .  Also refer to the CCP Quick Start Guide at http://www.cisco.com/en/US/docs/net_mgmt/cisco_configuration_professional/guides/CiscoCPqsg.html
         Over all link to CCP documentation is - http://www.cisco.com/en/US/products/ps9422/tsd_products_support_series_home.html
         Hope this helps.
    Regards
    Derek Clothier

  • How to run server application on that talks to applet in embeded in webpage

    i have a client(applet) and server application that are designed to communicate via sockets. the applet will run from a webpage and i know how to publish that. but the problem is the server application. i have been told that it too should run on my host, but how can i specify that and how to find out whether or not my host allows such a thing.
    any clarifying reply would be highly appreciated.
    sam

    If thinking about a Java solution, look at JSP/Servlet technology. (i.e. http://jakarta.apache.org)
    In short, servlets a classes that run in a container accesible by HTTP.
    There is also J2EE, wich uses RMI to perform this task.

  • Applet with Server sided webpage (asp, php)

    Hi Guys
    I have a quick question regarding the use of Applets..
    Let's say i've made an applet which i can put on a webpage to pick a date..
    What i want to do is have the applet post data to the server just like any normal web control (like a server-side asp.net control or a html textbox in php)
    Is this possible?
    Thanks
    -Nonameo-

    Nonameo,
    You can use HttpURLConnection to communication between the applet and server side code(servlet, php, etc.).
    On the applet do following:
    // get input data for sending
    String input = inputField.getText();
    // send data to the servlet
    URL urlServlet = new URL(getCodeBase(), "dir under your base");
    URLConnection con = urlServlet.openConnection();
    OutputStream outstream = con.getOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(outstream);
    oos.writeObject(input);
    oos.flush();
    oos.close();
    On the server side you will be able to get the data posted by the applet.
    Hope this helps.
    Chris

  • Underlying communication protocol for XI proxies (ABAP)

    What is the underlying communication protocol for XI proxies (ABAP) ?
    So, technically, how does the "actual" communication happen between SAP and XI when using proxies, as opposed to iDocs and BAPIs which use the RFC communication protocol.
    And how can you ensure that the proxy communication is "secure" ?
    Thanks in advance.

    hi,
    >>What is the underlying communication protocol for XI proxies (ABAP) ?
    it is SOAP.
    cheers,
    Naveen

  • How to handle when Client and server write to the socket at the same time

    Hi all,
    I'm writing a socket communication when client and server may write information the the socket at the same time. I look every where but the samples from the internet only shows example of server replies to client after receiving requests from clients.
    Let's say that:
    Client 1 ->Socket 1 -> Server 1
    Now if there are two threads in the server, one blocked waiting for the input from client on socket 1, the second one write something on the socket to client 1, is it possible?
    And if it's possible, if at the time Server 1 writes information to Client 1, Client 1 writes some information to Server 1 too, will there be any conflict problem or the socket could handle that two ways communication simultaneously?
    It's critical questions for me. Thanks for your help.

    I really use Server Client paradigm. However, beside the request, response mechanism, there is also an additional mechanism called update which server periodically send information update to client without the need for a request from client.
    So you suggest client should initiate 2 sockets, one for request and response, one for receiving update from the server? Will this work?

Maybe you are looking for

  • HT4623 Please help update ipad

    I am really struggling to update my iPad to iOS 5 or higher.  I don't know what version I have it's the original iPad. I have looked at the instructions to install iOS 5 and it says go to settings then to general and then software update.  Easy BUT I

  • HP PSC 1315 All in one printing problem

    My printer only prints text in red in the body. It will print black along the top and bottom of the paper.  It also prints in black when I copy something.  I put in new fresh cartridges.  What can I do?

  • Latest Flash version crashing both Firefox and IE

    Hello. Been using Flash in both IE and Firefox for years with no major problems until the last update a little over a week ago. Now, whenever I am watching video for more than about 5 minutes, the process for either browser's memory grows steadily wa

  • JDBC Data Sources: connecting the HR database from Oracle Express

    What goes in the data string? Where do I find the information for Host name, port and SDI? Thanks!

  • Long text updation using QSS_TEXT_PROCESSING

    Hi, I am entering Long text in Inspect. description  QE17  using QSS_TEXT_PROCESSING from  custom program. I could able to open editor (which comes in SAP standard transaction QE17) and enters text .Also the text module is been created. If you check