HTTP 1.1: Using streams over socket; How ?

Can anyone give me a short example as how to handle streams over a persistent socket-connection ?
I've trouble handling this.
I can't "reget" the stream (create a new input/output stream over an existing socket-connection).
Is there someone who can help me ?
I'm getting confused !!!

Since no one helped I could only try to find out myself:
The problem is I used some example-source that fitted well for HTTP 1.0, but led to erroneous results when applied to HTTP 1.1
It's no problem in HTTP 1.1, but you need to read ALL input (headers and possibly content) before trying to process anything:
From the headers you need to read until an empty line is discovered.... Don't just break on return or newline, this will leave an extra character in the input:
Protocol requires both \r and \n. So you always break 1 char to early when scanning bytes and then concluding on a \r that the line is over.
Then you should possibly read 'contentlength bytes' (I've not tried it out yet) in case of POST.
Flushing is enough to write all data to output.
Open and close can't work. "Regetting" a stream is not possible, so all input for this request must be taken from inputstream before trying to process the next request.

Similar Messages

  • What is the advantage of using RMI over socket connection

    plz tell me guys what is the advantage of using RMI over socket connection bcoz inherently RMI also uses socket connection.so what is the exact difference in between thm and what is the advantage of using RMI over socket connection.

    i knew tht bt i http://www.catb.org/~esr/faqs/smart-questions.html#writewell
    How To Ask Questions The Smart Way
    Eric Steven Raymond
    Rick Moen
    Write in clear, grammatical, correctly-spelled language
    We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding (often enough to bet on, anyway). Answering questions for careless and sloppy thinkers is not rewarding; we'd rather spend our time elsewhere.
    So expressing your question clearly and well is important. If you can't be bothered to do that, we can't be bothered to pay attention. Spend the extra effort to polish your language. It doesn't have to be stiff or formal — in fact, hacker culture values informal, slangy and humorous language used with precision. But it has to be precise; there has to be some indication that you're thinking and paying attention.
    Spell, punctuate, and capitalize correctly. Don't confuse "its" with "it's", "loose" with "lose", or "discrete" with "discreet". Don't TYPE IN ALL CAPS; this is read as shouting and considered rude. (All-smalls is only slightly less annoying, as it's difficult to read. Alan Cox can get away with it, but you can't.)
    More generally, if you write like a semi-literate b o o b you will very likely be ignored. So don't use instant-messaging shortcuts. Spelling "you" as "u" makes you look like a semi-literate b o o b to save two entire keystrokes.

  • Mixing byte & character stream over socket

    Hi,
    I would like to transmit a file name first to my server ( string )
    then I transmit the contents of an arbitrary file ( byte )
    I tried to chain two different filters to the InputStream instance returned by the socket, but it does not seem to work.
    What is the best way to do that ?
    Do I have to read my initial file name string by a byte stream and rebuild it ?
    Tks

    I Use this code
    InputStream bin = socket.getInputStream();
    OutputStream bout = socket.getOutputStream();
    PrintWriter in = new PrintWriter( bout, true);
    BufferedReader out = new BufferedReader(
    new InputStreamReader(bin) );
    on server and on client just change the socket reference,
    The programs works fine just the first and second time and after
    the second time, the PrintWriter and BufferedReader works
    as an InputStream and an OutputStream, Do you know how to indicate
    to the Print Writer and OutputStream that are reading text ?
    TNX, Alex

  • Stream-Mode Sockets

    Hi, I am working through a pradtice paper. I need to learn something for tomorrows exam.
    Here is the Question
    2b) Write detailed Java pseudo code fragments using stream-mode sockets. The code should reflect the following scenario:
    •     the server listens on a particular socket
    •     the client requests for a connection;
    •     the server accepts the connection request;
    •     the server sends the message “Send me a line of text” to the client;
    •     the client receives the message;
    •     The client sends the string “here is a line of text.”
    •     The server receives the line
    •     The server changes the text into upper case
    •     The server sends the changed text back.
    •     The client receives the changed text.
    Although your code does not need to be syntactically correct, it needs to be detailed enough to show the correct understanding of how the host addresses and port numbers are related to the sockets; it needs to show the correct use of classes and methods.
    So Far I have found thins:
    Client:
    package NetworkProgramming;
    import java.io.*;
    import java.net.*;
    public class Client2 {
    public static void main(String[] args) throws Exception {
    Client2 myCli = new Client2();
    myCli.run();
    public void run() throws Exception {
    Socket mySkt = new Socket("localhost", 9999);
    PrintStream myPS = new PrintStream(mySkt.getOutputStream());
    myPS.println("Hello Server");
    BufferedReader myBR = new BufferedReader(new InputStreamReader(mySkt.getInputStream()));
    String temp = myBR.readLine();
    System.out.println(temp);
    Server:
    package NetworkProgramming;
    import java.io.*;
    import java.net.*;
    public class Server2 {
    public static void main(String[] args) throws Exception {
    Server2 myServ = new Server2();
    myServ.run();
    public void run() throws Exception {
    ServerSocket mySS = new ServerSocket(9999);
    Socket SS_accept = mySS.accept();
    BufferedReader SS_BR = new BufferedReader(new InputStreamReader(SS_accept.getInputStream()));
    String temp = SS_BR.readLine();
    System.out.println(temp);
    if (temp != null) {
    PrintStream SSPS = new PrintStream(SS_accept.getOutputStream());
    SSPS.println("got Something");
    Is this the right stuff?
    How can i implement the parts in the question into this. like the sending messages, change to upper case etc.
    Many thanks for your help.

    1. When posting code, use code tags so it will be readable: http://forums.oracle.com/forums/ann.jspa?annID=1429
    2. You'll find you get better responses if you ask a more specific question and show your attempt to solve the problem yourself, as opposed to just pasting your assignment and some code you "found" and then asking, "How do I do the rest of this?"

  • I had iMessage with a UK number and I have moved to Australia and want to use an Australian number, how can I change it over?

    I had iMessage with a UK number and I have moved to Australia and want to use an Australian number, how can I change it over?

    something here may help
    http://support.apple.com/kb/TS4268

  • Receiver SOAP channel error: Communication over HTTPS. Unable to create a socket

    Hi,
    I am getting following error while sending message from PI (7.1) to SalesForce system:
    'SOAP: call failed: java.io.IOException: Communication over HTTPS. Unable to create a socket'
    Scenario: Sending Customer data from SAP via Async proxy to PI which is sent further to SalesForce system via SOAP webservice call.
    When I am trying to Post data to the same webservice via SOAP UI it is working fine and data is getting updated in SalesForce system.
    XPI inspector logs for the channel suggest the following:
    client [103965] RequestImpl.initSslAttributes(): Initially sslAttributes = null
    client [103965] RequestImpl.initSslAttributes(): Cannot find SSL headers in the request.
    client [103965] RequestImpl.initSslAttributes(): No SSL attributes: not found in headers and not searched in FCA, because connection.isSecure() = false; sslAttributes = null
    I have checked the following SAP Note and requested for updation of SSL icm parameters
    891877 - Message-specific configuration of HTTP-Security
    I checked the following discussions:
    http://scn.sap.com/message/8910518#8910518
    http://scn.sap.com/message/6244674#6244674
    http://scn.sap.com/thread/2100000
    http://scn.sap.com/thread/1632114
    which are suggesting a different approach. Kindly suggest a way forward.
    Thanks,
    Vishwajeet

    This is related network issue.
    Did you do telnet in pi server with target system ip and port?
    If you use https then you need to install certificates.
    Check below threads
    http://scn.sap.com/thread/190299
    Unable to create socket error

  • Slow streaming over wifi using ipad

    Why is streaming over wifi slower than over cellular connection?  Other devices don't have the same issue.

    generally we all think and expect wifi will be faster than a cell connection.  But that will not always be the case.  A good uncongested LTE runs pretty fast.
    But the wifi should be fast enough that you wouldn't notice any issues unless:
    You are using a public wifi spot where the signal is metered.  Where I work, they clamp the wifi for guests at 250k.
    The wifi cannot run any faster than your internet connection.  Is it clean?
    Recent stoires here are explaining how verizon and Comcast have been allowing you tube and netflix feeds to become overcongested, in an effort to extract $$ from them for the privilange of sending you the signal.
    a good place to start is to get a speed app - like Speed test (there are a bunch in the store) and see what speed your wifi is delivering.
    One thing that is almost certain, your wifi is a whole lot cheaper than your cell signal!

  • Streaming over HTTP

    I'm new to streaming, so hopefully this is a quick answer
    question.....due to firewall restrictions I would need to STREAM
    via HTTP protocol over (80)....I can't use RTMPT (which I was able
    to get working) because of protocol restrictions.....however, all
    the documentation keeps hinting that you can only progressive
    download via HTTP...is this true?
    However, other part of the doco say "you can stream via HTTP
    if you have APACHE installed". My assumption was that all this was
    doing was allowing Apache to serve the http "pages" and progressive
    download the files....so, long story short, can a file be streamed
    using FMIS over HTTP? Thanks for any help in advance.....

    No... I think the docs are just using the term "streaming" so
    the author didn't have to go into a long explanation of progressive
    video (to save the non-technical users from information overload
    maybe). You can't truly stream over HTTP. All HTTP flv delivery is
    progressive.
    That said, you can deliver a streaming-like experience using
    an HTTP application server. See the following:
    http://flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two

  • How to enter passcode using voice over accessibility

    How do i enter my passcode using voice over accessibility?

    Hello there, cathy555.
    The following section of the iPhone User's Guide provides some good information on using Voice Over:
    Use iPhone with VoiceOver - iPhone
    http://help.apple.com/iphone/7/#/iph3e2e2329
    Particularly:
    Enter your passcode silently. To avoid having your passcode spoken as you enter it, use handwriting; see Write with your finger.
    Enter your passcode silently. Set the rotor to Handwriting on the passcode screen, then write the characters of your passcode.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • HT1695 I accidentally deleted a picture app(hipstamtic) that wasn't downloading pics to my photo stream but my phone backed up last night over wifi - how can I revert my phone to that back up?

    I accidentally deleted a picture app(hipstamtic) that wasn't downloading pics to my photo stream but my phone backed up last night over wifi - how can I revert my phone to that back up?

    Depending on what kind of computer you have, you're gonna need to put that backup in the appropriate folder or itunes is not gonna be able to see it for you to use.

  • Video not played using JMF while tramitting stream over RTP

    video not played using JMF while tramitting stream over RTP
    I am using code to tranmit video using RTP using JMF and i am able to successfully get the video on client side
    Code to send the video over rtp
    http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/AVTransmit2.java
    code to recieve video over rtp
    http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/AVReceive.html#source
    My problem is i am not able to play video in AVTransmit2.java.
    If i create a player using datasouce, eigther i get player already occupied or a black screen.
    please help me running the video on Transmit side as well.
    NOTE: i am using web cam for video source
    Edited by: qasitouch on Dec 23, 2009 5:55 AM

    I am not getting any error on consol, rather video is not displayed on media screen but black rectangle.
    On Transmitter
         // Try to create a processor to handle the input media locator
         processor = Manager.createProcessor(ds);
    createPlayer(Manager.createCloneableDataSource(ds)); // here i am craeting a player to show the video on transmitter end aswell.
    Player code:
         private void createPlayer(DataSource ds) {
              try {
                   Player player;
                   if(processor!=null)
                        System.out.println("processor: " + processor);
                        player = processor;
                   }else{
                        System.out.println("null is processor");
                   player = Manager.createRealizedPlayer(ds);
                   Component video = player.getVisualComponent();
                   JFrame mediaFrame = new JFrame("Camera Screen");
                   mediaFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   mediaFrame.add(video);
                   mediaFrame.setSize(300, 300);
                   mediaFrame.setVisible(true);
                   player.realize();
                   player.start();
                   player.prefetch();
              } catch (NoPlayerException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (CannotRealizeException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (NotRealizedError e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    I am not getting any error and not running on the same side. My problem is showing video on Tranmitter end.
    Using above code i can create player and a black screen is showing, i am ubable to find, why video is not played in screen.

  • How to connect an apple tv to an enterprise network with a username and a password?   I need to use it over my university's wifi. theres no option to enter username and password. how to connect the apple tv to such enterprise network?

    How to connect an apple tv to an enterprise network with a username and a password?
    I need to use it over my university's wifi. theres no option to enter username and password. how to connect the apple tv to such enterprise network?

    Contact the University's IT dept, they may be able to set something up on the network to allow the ATV to connect without the need for a user name/password.

  • What are the limitations of using RMI over http with EJB?

    We have a requirement for an intranet application where the majority of the clients
    (Swing clients) will be able to connect directly using either T3 or IIOP. However,
    there are a number of clients that will need to traverse a firewall.
    We could use SOAP, but I dont want to lose the value that RMI gives us (clustering,
    security, statefullness support etc). I am thinking of using RMI over http - which
    Weblogic supports.
    I have been trying to find some documentation on the topic - but havent succeded
    so far. What I would like to understand is: What limitations I would have using
    RMI over http. Do I lose anything (apart from performance) using http?
    Regards,
    Nick

    You will have to enable tunneling on the server side and I have not heard of any
    complaints of using it.
    Shiva.
    Nick Minutello wrote:
    In fact, we are not using applets - and its not an internet application. We are
    using Java Webstart and Swing on our intranet (the problem of the size of the
    weblogic.jar is a pain - but well known)
    The question for me is; Apart from performance, are there any limitations to using
    RMI over http?
    Can we also use JMS over http?
    -Nick
    Shiva Paranandi <[email protected]> wrote:
    "Old wine new bottle".
    The biggest problem with the approach of Applets like
    stuff connecting to weblogic is the size of the classes that need to
    be supplied to the
    users. The applets/swing would need a lot of weblogic classes which you
    need to
    supply as jar file. This file can be in the order of MBs depending on
    the
    weblogic version. we had a similar kind of problem and migrated the applets
    to use
    servlets instead of directly invoking ejbs or jms topics etc. Having
    the applets
    connect
    to servlets you would still benefit from the features of clustering etc.
    and added to
    that
    you would reduce the number of remote calls.
    Shiva.
    Nick Minutello wrote:
    We have a requirement for an intranet application where the majorityof the clients
    (Swing clients) will be able to connect directly using either T3 orIIOP. However,
    there are a number of clients that will need to traverse a firewall.
    We could use SOAP, but I dont want to lose the value that RMI givesus (clustering,
    security, statefullness support etc). I am thinking of using RMI overhttp - which
    Weblogic supports.
    I have been trying to find some documentation on the topic - but haventsucceded
    so far. What I would like to understand is: What limitations I wouldhave using
    RMI over http. Do I lose anything (apart from performance) using http?
    Regards,
    Nick

  • I wiped my Mac desktop partition while using BootCamp. I want to just start over but how do i download snow leopard and start again?

    I accidentally wiped my mac OS partition while trying to expand the memory on BootCamp windows to play games. I did this through dropping memory on the mac then trying to merge the unallocated memory with windows 7. I'm now left with windows 7 and next to no memory, i dont have any data i care about backing up as i've only just got this mac (i bought it off a friend and they can't find the installation CD)  So i just want to start over but how can i do this?

    You'll need to find the disks, or buy new ones. Snow Leopard only comes on DVD.
    Call the Apple store and purchase SL for $29 while they still have some in stock. Prices have skyrocketed for SL retail disks. Going anywhere from $85 to $125. While you have Apple on the phone, make sure to have your Mac's serial number handy. This is important because the last retail release of SL was 10.6.3. If the Mac you now own came with 10.6.4 or later, it will not be able to use the retail disk.
    If that's the case, then you can use the serial number to get the correct replacement gray disks the Mac came with. It's not expensive to get them and would be good to have anyway since the retail disks do not include the bundled software such as iLife, Garage Band and a bunch of others.

  • How to use SQL OVER and PARTITION BY in OBIEE Expression Builder??

    Hi there,
    I want to create a new logical coulmn with the following SQL query.
    SUM(Inventory Detail.Qty) OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C,Inventory Detail.D,MyDATE )/SUM(Inventory Detail.Qty) OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C )
    How to use the OVER and PARTITION BY in OBIEE Expression Builder??
    Thanks in Advance

    hi bipin,
    We cant use by in Expression builder(rpd) .But use the same formula like this in Fx of answers
    SUM(Inventory Detail.Qty) OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C,Inventory Detail.D,MyDATE )/SUM(Inventory Detail.Qty) >OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C )SUM(Inventory Detail.Qty by Detail,ITEM,Mydate)/SUM(qty by detail,item)
    First check the numerator whether it was giving correct results or not then go with denominator
    compare the results with sql that u have
    Let me know if that does work
    thanks,
    saichand.v
    Edited by: Saichand Varanasi on Jul 27, 2010 9:27 PM
    Edited by: Saichand Varanasi on Jul 27, 2010 9:28 PM

Maybe you are looking for

  • How to select LOV items from edit report / form?

    I'm new to ApEx 3 with very little web developer knowledge. I have a create record form (Page1) that uses single-select and multi-select LOVs and correctly inserts the data into a table. I have a basic report (tabular form) (Page2) that shows the rec

  • New iMac can't see Laserwriter Select connected to a PC on same LAN-- why?

    I've just returned to the Mac universe after a five year hiatus. When I discovered how well Macs play with PCs and Unix these days, I decided to come back. There's just one issue: I can't print to my Laserwriter Select 360, connected by parallel port

  • Slide Audio plays twice, almost like an echo.

    Hopefully this is not weird and there's a quick fix, but basically, for a couple of my slides, the audio almost has like an echo. It's not the audio file iteslf, I've tested it many times. It seems as if there's a duplicate audio file playing about a

  • Adobe Captivate 7 Bookmarking

    Hi, I have built a SCORM course in Captivate 7 that marks the user as complete when they reach the last page. After completing a course, every subsequent time you launch it you are taken back to the assessment summary page, even if that wasn't the la

  • Lightroom corrupting RAW files? Hardware issue?

    I've started having some issues with RAW files being corrupted when I open them in Lightroom. I've done a lot to troubleshoot and narrow down the symptoms, and here is what I can tell you. If anyone has any ideas for how to solve this, I'd really app