SSL and line break "\n"

Hey,
I have a SSL client/server pair that pass messages between each other. Basically I'm having a problem where any sent message containing a line break are split based on this line break.
So if I sent "cheese \n monster \n", the server would recieve it as two different commands ("cheese" and "monster), instead of a single string.
Is this unavoidable? I could replace the line breaks with some other identifier and replace them with line breaks when the message is recieved. But I'd rather try and find a way around this first.
Thanks in advance :)

SSL doesn't do anything with line-breaks. Once the SSL handshake has taken place, it's just a Socket. I've used JSSE to transfer all kinds of data, and it doesn't do anything to the data being sent. If your code's behavior has changed after switching to SSLSocket, then I'm quite certain you've changed more than just the socket-type along the way.
What I'm saying is, if you're using readLine() to read from the Socket stream, then it's going to give you each line in turn - that's what readLine() does, whether your end datasource is a SocketInputStream or a File. If your data has linebreaks in it, then you have two choices - don't use readLine() the way you are, or encapsulate your data as a message. Say, have a "MESSAGE START" at the beginning, and a protocol that says "do readLine() until you see 'MESSAGE END' ", for example.
Grant
(Well, there is a third option - have a protocol that breaks in the face of line-ends in the data. But I don't think you want that one...)

Similar Messages

  • Why would white space and line breaks in sql query increase runtime

    Using 11.2.0.3.0 on unix sprac server, 8 cpus 32 cores 12TB storage. We have 16 batch servers doing inserts and ~100 users doing mostly queries.
    We have a wierd issue,  we have a long query that takes 30 seconds to run 1st time then 10-20 secs every other time. Based on knowledge of DB we expected it to take a lot less.  Then a developer reformatted it by taking removing extra white space and line breaks.  all of sudden query takes 6 secs first time and 0.8 every other time.  we tripled checked to ensure they are identical and that only difference is white space and line breaks.  We tried it with SQLDeveloper, TOAD, SQLPLUS, from out desktops, appserver. we could reproduce it every time, with white space 10-20 secs without it 0.8 secs.  Query is 200 lines long with white space 30 without it.
    Why would having white space make such a dramatic difference?  because the query is longer eventhough its identical?  We checked parsing times, etc, no difference.  Is there some network setting, oracle parameter, sqlnet setting?  We spent hours looking on google and found nother
    Slow:
      SELECT grt_student.student_id                                                                                                                                                                                                 
    AS student_id,
      grt_student.last_name                                                                                                                                                                                                       
    AS last_name,
      grt_student.first_name                                                                                                                                                                                                      
    AS first_name,
      grt_buyerinstance.buyerinstance_id                                                                                                                                                                                            
    AS buyerinstance_id,
      grt_buyerinstance.buyerfamily_id                                                                                                                                                                                              
    AS buyerfamily_id,
      grt_buyer.buyerfamily_acronym                                                                                                                                                                                                 
    AS buyerfamily_acronym,
      grt_reporting_utls_pkg.convert_gmrt_battery(grt_buyerinstance.buyerfamily_id,grt_buyer.battery)                                                                                                                                
    AS battery,
    fast:
    SELECT grt_student.student_id 
    AS student_id,  grt_student.last_name
    AS last_name, grt_student.first_name   AS first_name,  grt_buyerinstance.buyerinstance_id   AS buyerinstance_id,  grt_buyerinstance.buyerfamily_id
    AS buyerfamily_id,
      grt_buyer.buyerfamily_acronym  AS buyerfamily_acronym,  grt_reporting_utls_pkg.convert_gmrt_battery(grt_buyerinstance.buyerfamily_id,grt_buyer.battery)   AS battery,

    Do you have some sort of horrific network connection between the client and the database such that it would take 8.5 seconds to transmit a few kb of SQL to the server?  That seems most unlikely.
    How are you determining the query plan?  Are you absolutely sure that both SQL statements have the same plan_hash_value when they are actually executed (not just when you generate a query plan without executing it)?  What are the differences in wait events when you execute the two?
    The sql_id will change when you add or remove whitespace.  There are various methods of modifying query plans that are tied to a sql_id.  My wager would be that you have a profile/ outline/ etc. that is not there for the reformatted one which is causing a query plan difference.  My next guess is that you have an accepted plan for the old statement, you haven't set up a process to let the plan evolve, and the reformatted statement starts with the plan that the old statement would get if you allowed the plan to evolve.
    Justin

  • Spell Check and Line Breaks

    Hello,
    When creating a story/text box in ID, I often have lines with soft line breaks (shift-return).
    When I running spell-check, it sees the new, broken line as a new sentence.
    Example,
    "This is my sentence and then
    if I break it like this."
    Spell check will return "if" as an error which needs to be capitalized.
    Is there a way to turn off this aspect of spell check?
    Or some other way to avoid this issue?
    Thank you in advance.

    Nevermind. I think I figured out.

  • OutputLabel and line breaks doesn't work - Is there a hack for JSF1.2?

    Hello,
    I use JSF 1.2 and Facelets to generate a form automatically. This works so far well. But if I have a label with line breaks, JSF does not convert the line breaks into �
    � tags. Is there a hack to convert line breaks into �
    � tags?
    A little example
    Code:
    <h:outputLabel value="#{component.label}" for="#{component.id}" />
    <h:inputText value="#{component.value}" id="#{component.id}" />component.label = �First Line\nSecond Line�
    component.value = "UserInput"
    This is rendered to:
    First Line Second Line      [UserInput]
    Instead of:
    First Line        [UserInput]
    Second Line One possible solution is to disable �escape�. But this is a bad solution because there are umlauts and angle brackets (�<�,�>�) in some texts for my labels. Does anyone know a better solution?
    Regards
    Martin

    Hi Raymond,
    thanks for your tip. It is a very good idea. But while testing I have found a little problem. with "pre". JSF renders labels like this:
    <label> <---- notice this line break
    Text</label>All labels start with a line break in the HTML code. So all labels start with a line break in the browser too if I use CSS with the "pre" option :(
    Regards
    Martin
    Message was edited by:
    mwinandy

  • CVI Tree Control and Line Break

    Hi
    Is there a way in  CVI Treecontrol to do a line break if the column is to short ?
    Regards
    juergen
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=

    Hi jared,
    If the text is to long there should be a line break
    Regards
    Juergen
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=
    Attachments:
    shoot.jpg ‏27 KB

  • XML and line breakes

    I have ab XML like this
    <node>
    <child>Erat enim gulae deditus, cuius deus venter
    fuit. Nullumque sibi adserebat
    esse prudentiorem.
    </child>
    </node>
    I load the xml into flash in a dynamic textbox. The problem
    is that I get double line breakes:
    Erat enim gulae deditus, cuius deus venter fuit. Nullumque
    sibi adserebat
    esse prudentiorem.
    What is the problem?
    /E

    Do I have to parse the loaded text maybe?
    /E

  • Paragraph and line break tags not working in inserted html

    I used some code found on this forum to insert a text box with a scoll bar. The scroll bar is exactly what I needed, and I figured out how to style the text (using the text option that popped up on the far right side of the options bar), but for some reason the text all runs together. The <p> </p> tag is not creating the extra lines, nor could I get extra lines with <br/>. How can I get my paragraph spacing to show up?
    Here is the forum discussion: http://forums.adobe.com/message/4514956
    Here is the code I used:
    <style type="text/css">
         .scroll {     
             padding: 10px;     
             height: 280px;
             width: 450
    0px;
             overflow-y: scroll;
    overflow-x: hidden;;
    </style>
    <div class="scroll">
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
           Aliquam venenatis elit et dui scelerisque id condimentum
           tellus mollis. Phasellus varius augue at lectus egestas
           sit amet dapibus sem interdum. Vivamus aliquet augue vitae
           magna porttitor eget sagittis quam convallis. Integer aliquam
           sodales odio vel aliquet. Suspendisse non orci ut quam
           ultricies iaculis vitae vel neque. Sed sit amet neque a dui
           adipiscing convallis. Nam consectetur commodo arcu, eget
           feugiat risus tempus non. Suspendisse dignissim porta risus,
           eu lobortis metus facilisis non. Mauris id lacus eu tellus
           porttitor sodales in sed enim. Mauris euismod libero sed mi
           ultricies ac vehicula tellus tristique. Donec lacus tellus,
           varius sit amet mattis at, feugiat sed ante. Duis auctor
           iaculis aliquet. Vivamus fringilla nisi non eros congue
           dapibus. Praesent quis molestie mauris. Donec adipiscing
           dui ut elit interdum eu scelerisque sem pellentesque.
        </p>
        <p>Nulla pharetra nisl adipiscing ipsum fringilla at auctor
           ipsum posuere. Etiam ac dolor turpis. Nam non ligula purus.
           In metus nisl, ullamcorper ac sodales quis, molestie id leo.
           Etiam faucibus dui at eros molestie interdum. Quisque quis
           eros vel urna fermentum iaculis. Quisque vestibulum erat in
           risus lobortis malesuada rhoncus purus vestibulum. Integer
           vehicula ultrices quam, ac faucibus dui tristique sed. Duis
           nec felis mauris. Morbi non neque turpis, at lobortis mauris.
           Fusce a turpis sit amet leo ullamcorper semper et dignissim
           sem. Phasellus lacinia sodales massa, eget egestas velit
           malesuada at. Quisque feugiat erat in dolor eleifend ut
           convallis ante vehicula. Aenean a turpis neque, vitae eleifend
           augue. Class aptent taciti sociosqu ad litora torquent per
           conubia nostra, per inceptos himenaeos. Nunc porta, massa
           at viverra tincidunt, quam sem pellentesque felis, sed
           mattis lectus arcu eu turpis.
        </p>
        <p>Sed rutrum iaculis vulputate. Duis sed lectus lacus. Etiam
           faucibus, libero id placerat congue, turpis leo varius magna,
           vitae dapibus neque libero eu elit. Vivamus quis urna sed
           nibh elementum sodales quis in dolor. Sed ut metus ut metus
           facilisis fringilla vel sit amet mi. Etiam placerat lectus
           sed nibh bibendum vulputate non rhoncus est. Quisque vulputate
           luctus tincidunt. Duis quis tortor massa, sed scelerisque elit.
           Nam id vulputate orci. Morbi a porta lorem. Nunc elementum
           viverra sem quis blandit. Cras vel eros erat. Aliquam erat
           volutpat. Sed id odio nec erat viverra ultricies vel ac mi.
         </p>
    </div>

    For anyone else struggling with this problem, I chatted with support and got an answer. According to the agent "
    Muse is removing the default margin for various tags including the <p> tag to reset default styles to achieve consistency and control. All you need to do is specify the margin:1em for p tags in CSS to fix this."  Another --simpler-- solution turned out to be another suggestion the agent made: "just place <p> </p> after every closing </p> tag." The &nbsp is what turned out to work for me. Now I have a way to only show a portion of the text yet still allow the reader to access more (through a scroll bar) without leaving the page.

  • Regular expression and line break problem

    Hi friends,
    I was trying out one regular expression in java but, for some reasons its not working. The test string looks something like this in the eclipse watch window:-
    Test string:-*
    Content-Disposition: form-data; name="name"\n\nOmkar\n|
    In the above test string the last character is a pipe symbol.
    And the java code i have written is: -
    code:
        public static void getParameterValue(String paramName, String testParameter) {
                  String parameterRegex = "name=\""+paramName+"\"(.*)|";
                  Pattern pattern = Pattern.compile(parameterRegex,Pattern.DOTALL);
                  Matcher matcher = pattern.matcher(testParameter);
                  boolean isFound = matcher.find();
                  if (isFound) {
                       System.out.println("The parameter value is : "+matcher.group(1));
             }After, the debug line moves over the first line in this method, the value contained in the "parameterRegex" string variable is:-
    Regex:-*
    name="name"(.*)|
    However, my SOP statement, prints null....even though, "isFound" variable is true....can someone please explain me what could be the problem, where i am going wrong ?....
    I have even, set the DOTALL option for the regex.
    please some one help me!
    Thanks and Regards
    Omkar Patkar

    zomkar wrote:
    Sorry, folks, i did not mention the fact that i had posted the my query, in Java ranch also. But my problem lead to another problem of CROSS - POSTING !
    Apologies, for that !....but please, does any one have a solution to my regex ? .... any one ? please ?
    The value i get in paramaname is :- name
    which is present in double quotes in test string.
    is my regex incorrect ?The discussion at JavaRanch seems to be pretty alive, so why not leave this thread and continue there? That way, people won't have to first read two different threads on two different forums before trying to help you.

  • H:outputText and line breaks

    I have a textarea tag for input some text. This text has a new line special chars. How I can show this text with save formatting (h:outputText )? I need replace the new line special chars on <br> tag, but how?

    You can wrap the <h:outputText> with <pre> tags, which will preserve all whitespace. Otherwise, you would need to add a getter to your backing bean that does something like this:
    public class MyBean
       private String _textAreaStuff = null;
       public void setTextAreaStuff( String textAreaStuff )
          _textAreaStuff = textAreaStuff;
       public String getTextAreaStuff( )
          return _textAreaStuff;
       public String getTextAreaStuffAsHtml( )
          String textAreaStuffAsHtml = null;
          if( _textAreaStuff != null )
             return _textAreaStuff.replaceAll( "\n", "<br>" )
                .replaceAll( "\r", "" );
          return textAreaStuffAsHtml;
    }Then set the value of your <h:outputText> tag to be "#{myBean.textAreaStuffAsHtml}".
    - Jesse

  • Read Only TextAreas with Carriage Return, Line Breaks and Word Wrapping

    Hi all,
    I know there are a few posts around this subject but I cannot find the answer to the exact problem I have.
    I have a page that has a 'TextArea with Character Counter' (4000 Chars) that is conditionally read only based on the users credentials (using the 'Read Only' attributes of the TextArea item).
    When the field is editable (not Read Only) everything works fine but when I make the field Read Only I start to have problems:
    The first problem is that the Carriage Return and Line Breaks are ignored and the text becomes one continuos block. I have managed to fix this by adding pre and post element text of pre and /pre tags. This has made the Carriage Return and Line Breaks word nicely and dispaly correctly.
    However, it has introduced a second problem. Long lines, with no Carriage Returns or Line Breaks, now extend to the far right of the page with no word wrapping, making my page potentially 4000+ characters wide.
    How can I get the field to be display only, with recognised Carriage Returns and Line Breaks, and Word Wrapping inside a fixed width of, say, 150 characters?
    Many thanks,
    Martin

    Hi,
    Just a cut and paste of yours with the field name changed:
    htp.p('<script>');
    htp.p('$x("P3_COMMENTS").readonly=true;');
    htp.p('</script>');I also have the following in the page HTML Header, could they be conflicting?
    <script type="text/javascript" language="JavaScript">
    function setReleaseToProd(wpTypeCode){
       //setReleaseToProd($v(this))
      var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=set_release_to_prod',0);
      get.addParam('x01',wpTypeCode);
      gReturn = get.get();
      if(gReturn) {
         $s('P3_RELEASE_TO_PROD',gReturn);
      get = null;
    </script>I am a long way from knowing much about Javascript (this page code was written by someone else) so all help is much appreciated.
    Martin

  • Insert line break

    I am using v 7.0
    I have a 12 page outline and on page 7 I need to insert a new line of text.
    When using the Touchup text tool, insert and line break, a box is created around one line of text. Upon hitting the ENTER key instead of forcing a line break the line of text was pushed down and superimposed over a line of text below it. I am UNABLE to insert text in the newly created white space.
    1. How should I do this correctly?
    2. How may I correct this error?
    Thank you VERY much. frank

    You need to go back to the original document and make the change. Then create a new PDF. What you are trying to do is not a normal function of Acrobat. Editing can be done, but only minor editing. Moving lines is typically not one of the easy functions to do. You might be able to move the box below what you did enter, but that is about the only solution I know of.
    If you don't have the original, you probably need to export the file to a word processor or other text file and fix it there. You may have to reformat. That is likely easier than what you are trying to do, particularly if it is only a draft type document.

  • Line breaks not passing from flash to asp

    Hello,
    I've came up with a very anoying problem, and I need it fixed
    asap.
    The problem is as folows:
    I have a form in flash that contains a number of fields. One
    of those is a input field with the purpose of capturing the
    impressions of the user on a given subject. Needless to say that
    that impression may contain paragrafs, and line breaks. I'm using
    flash 7 publish settings and passing the values of the fields via
    LoadVars. The problem seems to be that no line breaks are passed to
    ASP. All the special characters are passed correctly, the HTML is
    coded as UTF-8 so that the portuguese characters are correctly
    decoded, but no line breaks are shown. I need a quick solution to
    solve this problem of the line breaks.
    Can someone give me a quick hand on this?
    Thx

    Thx kglad,
    Your solution is very simple... too bad I happened to create
    a solution on a much more complicated way... I ended up by escaping
    the string, detecting where the %0D was found, and replaced it with
    <br>. A much harder way to get to the same result... On
    future ocasions im gonna use your solution, which is way much
    simpler and doesn't require the number of coding lines that I had
    to create for the same purpose.
    Thx again m8

  • Line breaks within contents of floating fields

    Hello everyone,
    I have the following question regarding the usage of floating fields and line breaks:
    I have a text that incorporates a companies name using a floating field.
    If the name of the company is too large, a line break is forced automatically. In some cases the companies name is like "Company 123 N.V.". When the line break is forced on this company, its shows "Company 123 N." on the first line and "V." on the second line.
    How can i prevent the line break at "N."? I suppose the break is because of the "." in the text. But I want it only to be a line break if the "." is followed by a space, not if there is more text to it.
    The same sort of issue we face with floating fields containing for example telephone numbers ( format: "+31 (0) 20 - 123 456 1", line break at the "+", "(" or the spaces) and e-mail addresses ( [email protected], line break at the "@" or the ".") .
    Thanks for any reply on this.
    Regards,
    Joris

    I have the same problem. Does anyone have an answer for this one, please?
    Thanks,
    Vanessa

  • Creating a PDF in pages that retains all line breaks and formatting as source

    Currently when we get pages documents, we convert them to PDF and send them off to be converted by a partner. We do this because said partner doesn't accept pages.
    However, lately we've found issues in PDFs created by pages that do not retain styling nor line breaks correctly.
    Example for line breaks:
    The quick brown fox
    jumped over the lazy dog.
    When converted to PDF it shows exactly the same on the PDF, as it did pages. The paragraph breaks are retain in the pages document, and the PDF looks correct.
    But when you copy/paste the text (which is generally how we test how valid the actual text is) you get something like:
    The quick brown
    fox
    jumped over the lazy dog.
    In some cases we even get line breaks on every word.
    We used the Export to PDF feature, the Print to PDF feature, and even generated a postscript and distilled with Acrobat Pro.
    Does anyone know how to solve this? It seems anything generated with QuartzPDFContext has issues.

    Interesting that preview works, but not Acrobat. Thanks!
    We are using export to word as a second option. The formatting (as in exact spacing and such) isn't always 100% retained. PDF afterall is a representation of what the customer wants. We don't always suggest it but in some type of books it helps.

  • Convert rows to columns and put line break in between using t-sql

    Hi,
    I have a table with 5 columns..and my source data looks like this..
    RecordID  ID    Display          AddressType   EmailAddress
        1           1      GeneratedBy       From           
    [email protected]
        1           1      ReceivedBy         To               
    [email protected]
        1           1      ReceivedBy         To              
    [email protected]
        2           1
        3           1      GeneratedBy       From         
    [email protected]
        3           1      GeneratedBy       From          [email protected]
        3           1      ReceivedBy         To             
    [email protected]
    I need  t-sql to show output as..
    RecordID   ID    FullDisplay
       1       1     GeneratedBy  From -
    [email protected]  < CHAR(13) - Need Line Break here so that it goes to 2nd line>
                       ReceivedBy   To   - 
    [email protected] ; To -
    [email protected]
       2       1      Null
       3       1      GeneratedBy From -
    [email protected] ; From -
    [email protected]  < CHAR(13) - Need Line Break here so that it goes to 2nd line>
                      ReceivedBy  To   -
    [email protected]
    Display field will have 3 values - "GeneratedBy" , "ReceivedBy"  or Null
    AddresType field will have  3 values - "From" , "To" and Null.
    In the above example, Those 7 records belongs to ID=1.
    Whenever RecordID is same I want to show everything in one line with line breaks in between.
    In the above example RecordID=1 has 3 rows, display it as 1 row. But Whenever 'ReceivedBy' is there for same recordID put a line break before "ReceivedBy"
    create Statement:
    Create Table SampleTest
    (RecordID int null, ID int null , Dispplay varchar(20) null, AddressType varchar(6) null , EmailAddress Varchar(25) null)
    Insert Statement:
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (1,1,'GeneratedBy','From','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (1,1,'ReceivedBy','To','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (1,1,'ReceivedBy','To','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (2,1,  Null,Null,Null)
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (3,1,'GeneratedBy','From','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (3,1,'GeneratedBy','From','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (3,1,'ReceivedBy','To','[email protected]')
     Thanks!
    sql

    Try below
    drop table SampleTest
    GO
    Create Table SampleTest
    (RecordID int null, ID int null , Display varchar(20) null, AddressType varchar(6) null , EmailAddress Varchar(25) null)
    --Insert Statement:
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (1,1,'GeneratedBy','From','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (1,1,'ReceivedBy','To','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (1,1,'ReceivedBy','To','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (2,1, Null,Null,Null)
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (3,1,'GeneratedBy','From','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (3,1,'GeneratedBy','From','[email protected]')
    Insert into SampleTest (RecordID ,ID,Display,AddressType,EmailAddress) values (3,1,'ReceivedBy','To','[email protected]')
    with CTE1 as
    select ROW_NUMBER() over(PARTITION by RecordID ,ID,Display order by EmailAddress)rno,* From SampleTest
    ), CTE2 as (
    select RecordID ,ID,'GeneratedBy '+ STUFF(( SELECT '; From - ' + EmailAddress AS [text()]
    FROM CTE1 b
    WHERE
    a.RecordID=b.RecordID and a.ID=b.ID and b.Display = 'GeneratedBy'
    FOR XML PATH('')
    ), 1, 2, '' ) GeneratedBy,
    'ReceivedBy '+ STUFF(( SELECT '; To - ' + EmailAddress AS [text()]
    FROM CTE1 b
    WHERE
    a.RecordID=b.RecordID and a.ID=b.ID and b.Display = 'ReceivedBy'
    FOR XML PATH('')
    ), 1, 2, '' ) ReceivedBy
    From CTE1 a
    group by RecordID ,ID
    select RecordID ,ID,GeneratedBy +CHAR(13)+ ReceivedBy as FullDisplay from CTE2
    Thanks
    Saravana Kumar C

Maybe you are looking for