Network communication server-side (http, SSL)

Hey all,
I'm wondering if it's possible at all to make http or even
arbitrary network requests from the server-side on FMS. Based on
the documentation (which states that server-side ActionScript is
just JavaScript 1.5 with a few extra classes), there's no way to do
this, but I find that to be unbelievable. A $4,500 application that
doesn't give me the power to make an HTTP request to my web server?
There must be a way.
Also, I'd like to make HTTPS requests if possible. If that
means using an SSL socket and writing my own HTTP requests, or
using some HTTPS-capable socket or request object, that's fine.
Anybody know of a way to do this?
Also, does the same-origin (same-domain) security policy
still apply on the server side?

You can use flash remoting to call a web server or an
alternative is a webservice. There are APIs for both built into the
FMS server. Or as well a socket call.
As for HTTPS.. that I'm not sure, I've never had the need but
I *think* it is supported? Someone else know???

Similar Messages

  • Multiple room management -- best practice -- server side http api update?

    Hi Folks, 
    Some of the forum postings on multiple room management are over year old now.  I have student/tutor chat application which has been in the wild for 5 months now and appears to be working well.  There is a single tutor per room, multiple chats and soon to be a whiteboard per student, which is shared with the tutor in a tabbed UI. 
    It is now time to fill out the multiple tutor functionality, which I considered and researched when building, but did not come to any conclusions.   I'm leaning towards a server side implementation.  Is there an impending update to the http api?
    Here is what I understand to be the flow:
    1) server side management of who is accessing the room
    2) load balance and manage the room access 1 time user and owner session from the server side
    3) for my implementation, a tutor will need to login to the room, in order for it to be available
    4) Any reconnection would in turn need to be managed by the server side, and is really a special case of room load balancing.
    My fear is that at some point I'm going to need access to the number of students in the room or similar and this is not available, so that I'll need client functionality, which will need update the server side manager.
    As well, I'm concerned about delays on the server side access to which might create race conditions in a re-connect situation.  User attempts to reconnect, but server side manager thinks that the user is already connected.
    Surely this simple room management has been built, does anyone have any wisdom they can impart?  Is there any best practice guidance or any samples?
    Thanks,
    Doug

    Hi Raff, Thanks a ton for the response.
    I wasn't clear on what I was calling load balancing.  What I mean by this is room assignment for student clients.  We have one tutor per room.  There are multiple students per room, but each is in their own one-on-one chat with the tutor.
    I'm very much struggling with where to do the room assignment / room managemnt, on the server side or on the client side (if that is even possible).  In my testing it is taking upwards of 10 seconds minimum to get a list of rooms (4 virtually empty rooms) and to query the users in a single room (also a minimum of users/nodes in the queried room).   If after this point, I 'redirect' the student to the least full room, then the student incurs the cost of creating a new session and logging into the room.  As well I intend to do a bit of xml parsing, and other processing, so that 10 seconds is likely to grow.
    Would I see better performance trying to do this in the client?
    As far as the server side, at what point does a room go to 'not-active'?
    When I'm querying the roomList, I am considered one of the 'OWNER' users in the UserLists.  At what point can it be safe to assume that I have left the room? 
    Is there documentation on the meaning and lifecycle of the different status codes?  not-active,  not-running, and ok?  Are there others?
    How much staleness can I expect from the server-side queries?
    As far as feature set, the only thing that comes to mind is xpath and or wild card support for getNode() but i think this was mentioned in other posts.
    Regarding the reconnection issues, I am timing out the student after inactivity, and this is probably by and large the bulk of my reconnect use cases.  This and any logout interaction from the student presents a use case where I  may want reassign the student return to the same room as before.  I can envision scenarios of a preferred tutor if available etc.  In this case, I'll need to know list of rooms.  In terms of reconnection failover, this is not not a LCCS / FMS issue.
    Thanks again for responding.

  • Network location server Certificate binding fails.

    The certificate binding for the network location server has been modified. Without the correct certificate, connectivity for DirectAccess clients located in the internal network will not work as expected.
    1. The certificate binding has been changed by another process or application.
    2. The certificate is not bound to one or more IP addresses on the internal interface.
    1. Ensure the certificate binding has not been modified for the network location server.
    2. If you bind port 62000 with another certificate for use with a different application,  ensure that the network location server is configured to use the same certificate binding as that application.
    3. Ensure that the certificate is bound to all the IP addresses on the internal interface.

    Hi Proactis,
    If the certificate of the NLS has been modified, please try to re-issue a new certificate for NLS. Then we can reconfigure the NLS in the DirectAccess wizard.
    To re-issue the certificate for NLS, please follow the steps below,
    On the network location server, click Start, type mmc, and then press ENTER.
    Click File, and then click Add/Remove Snap-in.
    Click Certificates, click Add, select
    Computer account, click Next, select Local computer, click
    Finish, and then click OK.
    In the console tree of the Certificates snap-in, open Certificates (Local Computer)\Personal\Certificates.
    Right-click Certificates, point to All Tasks, and then click
    Request New Certificate.
    Click Next twice.
    On the Request Certificates page, click the Web Server certificate template, and then click
    More information is required to enroll for this certificate.
    On the Subject tab of the Certificate Properties dialog box, in
    Subject name, for Type, select Common Name.
    In Value, type the fully qualified domain name (FQDN) of the network location server (for example,
    nls.corp.contoso.com), and then click Add.
    Click OK, click Enroll, and then click
    Finish.
    In the details pane of the Certificates snap-in, verify that a new certificate with the FQDN was enrolled with
    Intended Purposes of Server Authentication.
    For detailed information, please refer to the link below,
    Install and Configure IIS for a Network Location Server Certificate
    http://technet.microsoft.com/en-us/library/ee649252(v=ws.10).aspx
    Then we may need to reconfigure the NLS in the DirectAccess wizard, here is the screenshot of my lab server,
    Besides, don't forget to update the group policy on DirectAccess server and client.
    Best Regards.
    Steven Lee
    TechNet Community Support

  • Invoking Trigger on Server Side on Startup instaed from Client

    Hi,I want to invoke a server side trigger at the start-up w/o client invoking it? How can I do it. The examples given with the weblogic server involves Invoking the trigger from the client.CIAOAjay

    What is the best/easiest way to fetch client data ("First and last name" - CN, OU ...) from server side, over SSL connection?Require client authentication and get the peer certificate from the SSLSession during or after the handshake.
    Is there way to use data from SSL signature from applicationNo.

  • HOWTO: Setting up Server-Side Authentication with SSL

    This howto covers the configuration of server-side SSL authentication for both Net8 and IIOP (JServer) connections. It documents the steps required to set up an SSL encrypted connection; it does not cover certificate authentication.
    It is worthwhile noting that although the setup of SSL requires the installation of certificates, these certificates do not have to be current, only valid. For some reason, in order to enable SSL connections, it is necessary to set up valid certificate file on the server whether you intend to use certificate authentication or not.
    NOTE: I have been unable to determine whether or not the above statement is entirely correct. If anyone can confirm or disprove it, please let me know.
    The steps described below must all be carried out from the same logon account. They have been tested on both 816 and 817 databases, but will probably work for all versions, including 9i (unless there have been some drastic changes in 9i that I'm not aware of).
    1. Log on to the database server with an administrative login.
    Configure the database and listener to run under the current login account (Control Panel -> Services). It is not necessary to restart these services at this time.
    2. Create an Oracle wallet and set up the required certificates
    (i) Open the Oracle Wallet Manager:
    Start -> Programs -> [Oracle Home] -> Network Administration -> Wallet Manager
    (ii) Create a new wallet (Wallet -> New).
    (iii) When prompted, elect to generate a certificate request.
    (iv) On the request form, the only field that matters is the Common Name. Enter the fully qualified domain name (FQDN) of the database server (i.e. the name with which the database server will be referenced by clients).
    (v) Export the certificate request to file (Operations -> Export Certificate Request).
    (vi) Obtain a valid server certificate from an authorised signing authority. It will also be necessary to download the signing authoritys publicly available trusted root certificate. Certificates can be obtained from Verisign (http://www.verisign.com/)
    (vii) Install the trusted root certificate obtained in (vi) into the wallet (Operations -> Import Trusted Certificate). Either paste the contents of the certificate file, or browse to the file on the file system.
    (viii) Install the server certificate obtained in (vi) into the wallet (Operations -> Import User Certificate). Either paste the contents of the certificate file, or browse to the file on the file system.
    (ix) Save the wallet (Wallet -> Save). The wallet will be saved to the [user home]\Oracle\Wallets directory.
    3. Configure the listener for SSL.
    (i) Open the Oracle Net8 Assistant:
    Start -> Programs -> [Oracle Home] -> Network Administration -> Net8 Assistant
    (ii) Select Net8 Configuration -> Local -> Profile.
    (iii) From the drop-down list at right, select Oracle Advanced Security. Select the SSL tab.
    (iv) Select the Server radio button.
    (v) In the wallet directory field, enter the location of the wallet created in step 2, e.g. C:\WINNT\Profiles\oracleuser\ORACLE\WALLET
    (vi) Uncheck the Require Client Authentication checkbox.
    (vii) Select Net8 Configuration -> Listeners -> [listener name].
    (viii) Add a new address:
    Protocol: TCP/IP with SSL
    Host: [database server FQDN] (e.g. oraserver)
    Port: 2484
    (ix) Add a second new address:
    Protocol: TCP/IP with SSL
    Host: [database server FQDN] (e.g. oraserver)
    Port: 2482
    Check the Dedicate this endpoint to IIOP connections checkbox.
    (x) Save the Net8 configuration (File p Save Network Configuration).
    (xi) Restart the listener service.
    4. Configure the database to accept SSL connections.
    (i) Open the database inti.ora file (\admin\[SID]\pfile\init.ora or equivalent).
    (ii) At the bottom of the file, uncomment the line that reads
    mts_dispatchers = "(PROTOCOL=TCPS)(PRE=oracle.aurora.server.SGiopServer)"
    (iii) Save the file and restart the database service.
    5. Test the SSL confi guration using the Net8 Assistant.
    (i) Open the Oracle Net8 Assistant.
    (ii) Select Net8 Configuration -> Local -> Service Naming.
    (iii) Add a new net service (Edit p Create).
    Net service name: [SID].auth (e.g. iasdb.auth)
    Protocol: TCP/IP with SSL
    Host: [database server] (e.g. oraserver)
    Port: 2484
    Service Name/SID: [SID] (e.g. iasdb.orion.internal)
    Note: at the end of the net service configuration, click Finish, not Test. The test can hang if run from the wizard.
    (iv) Test the connection (Command -> Test Service). If the only error to appear is username/password denied, the test has succeeded.
    null

    Dear Alex,
    Thank you for reaching the Small Business Support Community.
    I would first suggest you to uncheck the "Perfect Forward Secrecy" setting on the RVS4000 and if see if there is some similar setting enabled, then disable it, on the other side.  If still the same thing happens, then go to RVS4000, VPN Advanced settings, and disable the "Aggressive Mode" so it becomes "Main mode" and use the same on the other end of the tunnel.
    Just in case and as a VPN configuration guide, below is a document called "IPSec VPN setup" if it helps somehow;
    http://sbkb.cisco.com/CiscoSB/Loginr.aspx?login=1&pid=2&app=search&vw=1&articleid=587
    Besides my suggestions I would advise you to contact your ISP to make sure there is no IPSec traffic restrictions and/or if there is something in particular they require to make this happen and please do not hesitate to reach me back if there is any further assistance I may help you with.
    Kind regards,
    Jeffrey Rodriguez S. .:|:.:|:.
    Cisco Customer Support Engineer
    *Please rate the Post so other will know when an answer has been found.

  • Network communication Xacute applets client - Mii server

    Hi all,
    I have a rather technical question.
    Does anybody know what goes on from a network communication point of view when an applet on a irpt-page gets executed and fetches data from the Mii server?
    Do these applets use RMI or some other method?
    It's because we might have network issues, and I would like to know how the applets work on network level.
    Our architecture is as follows:
    On the client an irpt page is displayed in a browser (MSIE).  The irpt page contains applets generated by Xacute queries.  We also rely a lot on JS.
    The client application communicates with the Mii server over the WAN.
    So if someone can tell me which ports are used by the applets, would be great!
    W.

    Ok, on the server side indeed the applets connect to 5nn00.  I love the debug option!
    Now, on our WAN we have defined a QoS, for traffic prioritizing.  So certain port numbers (or ip-adresses) get priority over the network.  We added port 52000 (used by Mii) to this QoS, but unfortunately the traffic does not get prioritized.
    The problem is that on the client side (Mii HTTP application), we cannot control which ports are opened (that's the OS).
    On client side it could be port 4000 to 65999 or something.   When we do port-prioritizing, this can never work.
    So how do we configure our QoS?  Prioritize everything going to and coming from the Mii server?
    Anyone experience with that?  I know it's not directly related to SAP and Mii, but when working with Mii one stumbles onto all kind of technologies
    cheers!

  • Establish a connection through RF modem's on client & server side & to set up PPP communication for data transfer

    hi
    can any1 over here help me out in how to establish connection between 2 RF modem's for data transfer , between client & server USing LABVIEW?
    I want to establish a connection between 2 PC's through  RF modem on client & server side & to set up PPP communication for data transfer.
    (I have tried data transfer through RS-232 using TCP/IP whn the 2 PC's are connected over ethernet... which is working.
    I also tried connecting loopback cable between 2 PC's COM port & geting data transfer using VIsa configure serial port & other visa functions  ... which is working)
    can u guide me how to establish connection between 2 RF modem's using LABview?
    & how does the data transfer take place between 2 RF modems through RS-232?
    is it using TCP/IP?
    If you got any links to go abt this issue do send me related links .. or any examples .....
    I am currently using Labview version 8.
    Waiting in anticipation.. reply ASAP..
    thanking you
    Regards
    Yogan..

    Howdy yogan,
    Maybe you could clarify a few things for me, and we'll see how we can help ya. TCP/IP protocol occurs through an ethernet connection; RS-232 communication occurs through an RS-232 serial connection, typically through a cable that has a DB9 connector on both ends. Do you mean that the RF modems in question have the option to communicate via RS-232 and/or via TCP/IP ethernet? Specific information like the manufacturer of your RF modems, the model number of your RF modems, and how you connect the modems to the PC would enable us to give you more efficient support.
    You can check our Instrument Driver Network (IDNet) to see if a plug-and-play/IVI driver already exists for your RF modem. (You'll need to know its manufacturer and model number.) In the case that you do find an IDNet driver for your modem, you can use this KnowledgeBase article for instructions on how to use the driver.
    Another excellent resource to consider is the NI Example Finder. You can access this within LabVIEW by navigating to Help»Find Examples and then searching for serial or TCP/IP examples.
    Message Edited by pBerg on 03-10-2008 04:35 PM
    Warm regards,
    pBerg

  • Getting following exception on TCP ssl at server side

    Hi,
    I am trying to setup an ssl client and ssl server.
    But on ssl client side, My need_wrap going into loop(Buffer overflow)
    On my server side, i am getting following error.
    Please help me...I am not getting much discussion/articles to solve this problem.
    javax.net.ssl.SSLProtocolException: Handshake message sequence violation, state = 1, type = 1
    javax.net.ssl.SSLProtocolException: Handshake message sequence violation, state = 1, type = 1
      at sun.security.ssl.Handshaker.checkThrown(Handshaker.java:1371)
      at sun.security.ssl.SSLEngineImpl.checkTaskThrown(SSLEngineImpl.java:513)
      at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:790)
      at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:758)
      at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
      at com.ipay.ssl.SSLServerNio.doHandshake(SSLServerNio.java:55)
      at com.ipay.ssl.SSLServerNio.main(SSLServerNio.java:215)
    Caused by: javax.net.ssl.SSLProtocolException: Handshake message sequence violation, state = 1, type = 1
      at sun.security.ssl.ServerHandshaker.processMessage(ServerHandshaker.java:156)
      at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868)
      at sun.security.ssl.Handshaker$1.run(Handshaker.java:808)
      at sun.security.ssl.Handshaker$1.run(Handshaker.java:806)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.security.ssl.Handshaker$DelegatedTask.run(Handshaker.java:1299)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:744)
    My server handshake code look like this.
    void doHandshake(SocketChannel socketChannel, SSLEngine engine,
             ByteBuffer myNetSendData, ByteBuffer myNetRecieveData) throws Exception {
         // Create byte buffers to use for holding application data
      ByteBuffer myAppDataSend = ByteBuffer.allocate(engine.getSession().getApplicationBufferSize());
      ByteBuffer myAppDataRecieve = ByteBuffer.allocate(engine.getSession().getApplicationBufferSize());
      System.out.println(engine.getPeerPort());
         // Begin handshake
         engine.beginHandshake();
         SSLEngineResult.HandshakeStatus hs = engine.getHandshakeStatus();
         // Process handshaking message
         while (hs != SSLEngineResult.HandshakeStatus.FINISHED &&
             hs != SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING) {
          switch (hs) {
             case NEED_UNWRAP:
              System.out.println("Reached NEED UNWRAP");
                 // Receive handshaking data from peer
                 if (socketChannel.read(myNetRecieveData) < 0) {
                     // Handle closed channel
                  System.out.println("not able toRead data from channel to buffer at client");
                 myNetRecieveData.flip();
                 // Process incoming handshaking data
                 SSLEngineResult res = engine.unwrap(myNetRecieveData, myAppDataRecieve);
               //  myNetRecieveData.compact();
                 // Getting handshake status
                 hs = res.getHandshakeStatus();
                 System.out.println("Debugging in NEED_UNWRAP-->"+hs);
                 // Check status
                 switch (res.getStatus()) {
                 case OK :
                     // Handle OK status
                  System.out.println("OK");
                     break;
                 case BUFFER_OVERFLOW:
                  System.out.println("BUFFER OVERFLOW");
                  break;
                 case BUFFER_UNDERFLOW:
                  System.out.println("BUFFER UNDERFLOW");
                  /* if (socketChannel.read(myNetRecieveData) < 0) {
                     // Handle closed channel
                  System.out.println("not able toRead data from channel to buffer at client");
                  hs=HandshakeStatus.NEED_UNWRAP;
                  System.out.println("Read data on underflow condition");
                  break;
                 case CLOSED:
                  System.out.println("CLOSED");
                  break;
                 // Handle other status: BUFFER_UNDERFLOW, BUFFER_OVERFLOW, CLOSED
                 break;
             case NEED_WRAP :
              System.out.println("Reached NEED WRAP");
                 // Empty the local network packet buffer.
                 // Generate handshaking data
              //myAppDataSend.flip();
                 res = engine.wrap(myAppDataSend, myNetSendData);
                 // Getting handshake status
                 hs = res.getHandshakeStatus();
                 System.out.println("Debugging in NEED_WRAP-->"+hs);
                 // Check status
                 switch (res.getStatus()) {
                 case OK :
                  System.out.println("OK");
                     myNetSendData.flip();
                     // Send the handshaking data to peer
                     while (myNetSendData.hasRemaining()) {
                         if (socketChannel.write(myNetSendData) < 0) {
                             // closing socket channel
                     break;
                 case BUFFER_OVERFLOW:
                  System.out.println("BUFFER OVERFLOW");
                  //Writing network send buffer
                  myNetSendData.flip();
                     while (myNetSendData.hasRemaining()) {
                  if(socketChannel.write(myNetSendData) < 0)
                  System.out.println("Some thing wrong happened");
                  System.out.println("written data");
                  hs=HandshakeStatus.NEED_WRAP;
                  break;
                 case BUFFER_UNDERFLOW:
                  System.out.println("BUFFER UNDERFLOW");
                  break;
                 case CLOSED:
                  System.out.println("CLOSED");
                  break;
                 // Handle other status:  BUFFER_OVERFLOW, BUFFER_UNDERFLOW, CLOSED
                  break;
             case NEED_TASK :
              System.out.println("NEED TASK");
              System.out.println("Debugging in NEED_TASK-->"+hs);
              Runnable task;
              while((task=engine.getDelegatedTask()) != null)
              System.out.println("Inside while loop");
              ExecutorService executorService = Executors.newFixedThreadPool(1);
              executorService.execute(task);
                 // Handle blocking tasks
              hs=engine.getHandshakeStatus();
              System.out.println("Printing"+engine.getHandshakeStatus());
              break;
             case FINISHED:
              System.out.println("Debugging in FINISHED-->"+hs);
              System.out.println("handshake done");
              hs=HandshakeStatus.FINISHED;
                    break;
             // Handle other status:  // FINISHED or NOT_HANDSHAKING
         // Processes after handshaking
    brs,
    varghese

    Hi Zia,
    The error is...
    Caused by: java.io.InvalidClassException: org.eclipse.persistence.indirection.IndirectList; local class incompatible: stream classdesc serialVersionUID = 4038061360325736360, local class serialVersionUID = -494763524358427112
    ...which means you have two different versions of org.eclipse.persistence.indirection.IndirectList, one on the server and one in the client (JDeveloper). As these classes have different serialVersionUID values then Java throws an exception when deserializing as they are probably not compatible.
    I don't know much about the Eclipse stuff but from looking at your post I can only assume one version of the class is in D:\Coherence\toplink\jlib\eclipselink.jar on the Coherence server side and the other is in JDevloper in D:\OracleSOA\Middleware\modules\org.eclipse.persistence_1.1.0.0_2-1.jar as these are the only jar file containing "eclipse" that I can see on the classpaths.
    JK

  • Client /server model of network communication

    can some some tell me what is meant by the client / server model of network communication?

    See this networking tutorial
    http://java.sun.com/docs/books/tutorial/networking/index.html
    You could have asked both questions in the same post, as they are related.

  • Bw web report plugin http session hangs at the server side

    Hi,
    I am having problems when closing the browser of a BW web report. After I closed the browser by going File->close, I ran SM04 and found out the Plugin HTTP session hangs at the server side.
    How can we terminate the Plugin HTTP session at the server side when user closes the internet browser?
    I did implement a logoff function at my web template, if user clicks on the logoff, the Plugin HTTP session is terminated at server side correctly. But As you know, 50% of time user will close the report by closing the internet browser instead of clicking the logoff. That leaves lots of hanging Plugin HTTP sessions at our server side.
    By the way, we actived our BEX service at the SICF.
    Thanks for help!
    JA

    Hi
    If you want to avoid a blank page with logoff button, add opener=0
    <a href="<SAP_BW_URL CMD='LOG_OFF' ~command='logoff'
    >" onClick="javascript:window.close(opener=0);">Log off</a>
    If you want to close the session via X, use this code:
    create a sapscript function
    function closeSession()
    logoff()
    window.unload=CloseSession()
    However, the Plugin HTTP session isn't killed.
    Regards

  • Http Authentication server side

    I searched the internet and this forum a lot without finding a non commercial solution to this common scenario.
    Inside an active directory based intranet I would like to authenticate the users who access a java web application running on Tomcat.
    The requisites to meet are:
    - the users connect with IE6 and they are authenticated with their login credentials using Kerberos.
    - the application needs to know the name of the user.
    The web application will run with a specific windows account. Is there a way to perform a task using the credentials of the authenticated user ?
    What I'm looking for is an implementation of the following scenario: User John connects to the web application and besides other tasks, read/writes files from a directory where only John has permissions to do (as configured through windows acl).
    Thanks for any help.
    Filippo

    So far as I know, to do this you would have to run the server side of HTTP Negotiate (SPNEGO) in Tomcat. This protocol uses HTTP Authorization exchanges to carry out the GSS-API exchange that allows Tomcat to trust the browser user's identity. In this context the GSS-API mechanism would be Kerberos (or NTLM if Kerberos failed). The browser (if HTTP Negotiate capable, like IE) would send Kerberos credentials to the server during the context exchange, thereby achieving what you want.
    I believe this is what commercial products like Vintela and IT Practice do.
    Question to the Sun developers: SE6 supports the client side of HTTP Negotiate (so a Java client can talk to e.g. IIS). Are there any plans to support the server side? The case of IE/Windows workstations accessing Java web servers/servlet engines is a much more common requirement than "the other way round".
    Thanks,
    Alec

  • Communication beween an http client a servlet and a socket server

    Hello I&#8217;m developing an application that needs a client to communicate with a servlet using Http and then the servlet needs to connect to a server using sockets.
    The client will send an image to the servlet and then the servlet will send that image to the server.
    Everything works OK except when I try to send the data from the servlet to the server. It seems that there is no indication of when the outputstream has reached its end. So when trying to do this at the server side:
    BufferedInputStream inFromClient =
                  new BufferedInputStream(serverSocket.getInputStream());
    int inp=0;
    while ( (inp=inFromClient.read())!=-1 )
             //do smth
    }The server will block at the read() method.
    If I close the connection from the servlet using the close() method of a print stream everything will work fine
    but I don't want to do that because I want the server to send a message back at the servlet.
    I don't know if I make any sense but I'm new to servlets and Java as well.
    Thanks in advance and if there something that you don't understand please let me know.

    I'm not quite sure what you mean. I have tried to do the same in the following piece of code and it worked fine. The only difference is that here the data is read from a file but I still send it as raw data(bytes).
    import java.io.*;
    import java.net.*;
    public class Client
        private String path="c:\\img0049.jpg";
        private static void sendImage(Socket client,BufferedOutputStream toServer)
             BufferedInputStream readFile=null;        
             int inp=0;        
             try
                  readFile = new BufferedInputStream( new FileInputStream(path) );
                  while ( (inp=readFile.read())!=-1 )
                        toServer.write(inp);
              catch (IOException e)
                   e.printStackTrace();
              finally
                if (readFile != null)
                     try {
                   readFile.close();
              } catch (IOException e) {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                     //client.close();
        public static void main(String args[]) throws Exception {
            // connect through localhost to the same port that the server is listening to
            Socket clientSocket = new Socket("127.0.0.1", 4322);
            BufferedOutputStream outToServer =
                    new BufferedOutputStream(clientSocket.getOutputStream());             
                sendImage(clientSocket,outToServer);              
            outToServer.close();
            clientSocket.close();
        }// main   
    }// classIn the server side I'm just reading it with something like that
    try {
                    BufferedOutputStream out =
                         new BufferedOutputStream( new FileOutputStream("c:\\out.jpg"));
                    int inp=0;
                    while ( (inp=inFromClient.read())!=-1 )
                         out.write(inp);
                    out.close(); //close will also flush
    //.....rest of codeNow here is the servlet code of the application that I'm discussing (the servlet has already received the data from the client using the Htpp protocol. I know it has through debugging).
    I'm guessing that the servlet is storing my data in the BufferedInputStream so then I'm trying to read from there and send it to the server
    public void doPost(HttpServletRequest request, HttpServletResponse response)
                   throws IOException, ServletException
              /* Get input stream from mobile client: Servlet<-- Client */
              ServletInputStream inputFromClient = request.getInputStream();
              BufferedInputStream bufInputFromClient = new BufferedInputStream(inputFromClient);
              /*Create socket and get output stream in order to communicate with
               * Server: Server<-- Servlet */
              Socket clientSocket = new Socket("127.0.0.1",4322);
              OutputStream outputToServer = new PrintStream(
                        clientSocket.getOutputStream());
              /* Empty buffer and send data to output stream */
              int inp=0;          
                         while ( (inp=bufInputFromClient.read())!=-1 )
                          outputToServer.write(inp);
                        outputToServer.flush();                   
                       //outputToServer.close(); //If I use this the server will know that the stream has ended                   At the server I'm using again the 2nd piece of code I posted above.
    That's it I hope I'm not confusing you.Thanks

  • Server side does not detect network failure

    Hi folks,
    I coded a simple chat program. When a client connects to the multi-thread server, server shows newly connected client's IP address. Now, if the connection between client and server is down, client detects and terminates itself but server does not. The server still shows that client as connected. when I traced the server side, I found out that server was waiting at the readObject (client object input stream) line but it didn't throw any IOException. I tried to send some message to all connected client at every 20 seconds, so I expected to catch IOException when the server did not reach the client. Unfortunately, it didn't work. That is my question how can server side detect network failure?
    Thanks for help.
    Regards
    Bulent

    That is how TCP works (noting that it has nothing to do with java.)
    Your solution is one of the following or some combination...
    - If the server does not receive something every X time period then it disconnects.
    - If the server has not received something after X time period it sends a keep alive message to the client. If the client does not respond (or the message fails) then the server disconnects.

  • Server Side Actionscript for HTTP Streaming Connections, is it supported?

    Hi, I have a server side actionscript application working for RTMP, and I would like to reuse this code for HTTP connections.
    Is this possible?

    Thank you for your answer.  If I understand what you are saying, the apache modules proxy http to rtmp on the streaming server.  I have an application that is passing context into the rtmp server side javascript using a url similar to this:
    rtmp://myhostname.com/myapp?mycontext/mp4:myfilename
    Do you think there is a way to pass the mycontext through the http url so that the Server Side Actionscript can perform an operation based on that context?

  • Server Side SSL

    Hi,
    I'm trying to create a JSP than use the SSL technology,
    I create the certificate and configurates the web server,
    is needed write some additiona code in the server side (JSP) ???

    you have to set some policies,i.e some system properties, using
    System.setProperty(). Let's take below lines of code, usually placed in the top lines of code..... and as global variables in the JSP page.
    System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
              java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
              System.setProperty("javax.net.debug","all");
    And you need to set trust store for the own keystore, if it is trusted. and if you have anonymous class for that, no need to set this property.
    try... now the jsp works out....
    all the best

Maybe you are looking for

  • Page Thumbnails not displaying in Pages Panel

    Hi all, Hopefully a quick question...I've searched through the Forum and not spotted a similar issue. I have a user who is experiencing an unusual issue in InDesign CS6 - Page Thumbnails aren't displaying in the Pages Panel (such that the panel is co

  • Why can't I download or update apps running IOS 8.1.1

    help

  • How to download oracle linux 6 packages ?

    hi, my system have no access to the internet. How do i download the packages ? compat-libcap1-1.10 compat-libstdc++-33-3.2.3

  • Need Help by some % calculation

    Hi Guys, i need some help calculating something. I have 5 boxes; "boxA" - "boxB" - "boxC" - "boxD" and "boxE". Box A–C are sums coming from other fields. "boxD" represent the VTA – and can be just 19% ore 0%. This means that "boxE" = ("boxA" + "boxB"

  • Is there a way to sort/filter hinting?

    I love the code hinting.. I'm just wondering if there's any way to make it sort or filter according to where the properties/methods are inherited from. For example if I type the name of a form on my page and gives a really long list, I would love to