2 Replies Latest reply: Feb 21, 2007 5:41 PM by 807599 RSS

    sending data over and socket

      when i send messages over socket and receive it using
      [line = in.readLine()/code]
      if there is a \r\n it stops and makes u have to use readLine again to get the rest of the message
      is there a way to send the message so it totally ignores the \r\n and i can just use readLine once to receive my complete string in one go
      as this newline thing is very annoying
      thanks :)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
        • 1. Re: sending data over and socket
          I assume in is of type BufferedReader? If so, that is the definition of readLine.
          Other options:

          You can use java.util.Scanner to scan until the next delimiter, which you can set.
          You can use readUTF/writeUTF defined in interfaces DataInput/DataOut by
          using classes DataInputStream/DataOutputStream or ObjectInpuitStream/ObjectOutputStream.

          If you are using object stream, you could define any serializable objects you
          like for transmission.
          • 2. Re: sending data over and socket
            yeah i was using BufferedReader

            thanks ill try them other methods out