Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. StreamReader.ReadLine()

StreamReader.ReadLine()

Scheduled Pinned Locked Moved C#
comhostingquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    staticv
    wrote on last edited by
    #1

    Hey I have a StreamReader whose underlying stream is a NetworkStream, when I read from it, it throws a FormatException. What could be the causes? I am writing "r\r\n" to the NetworkStream and then call the StreamReader.ReadLine() method on the client side and it throws this exception. What am I doing wrong?

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    D R 2 Replies Last reply
    0
    • S staticv

      Hey I have a StreamReader whose underlying stream is a NetworkStream, when I read from it, it throws a FormatException. What could be the causes? I am writing "r\r\n" to the NetworkStream and then call the StreamReader.ReadLine() method on the client side and it throws this exception. What am I doing wrong?

      Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You possibly got an incomplete packet of data? You possible only got a partial line of data from the network stream. Without seeing the code that handles this, it's impossible to say.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      1 Reply Last reply
      0
      • S staticv

        Hey I have a StreamReader whose underlying stream is a NetworkStream, when I read from it, it throws a FormatException. What could be the causes? I am writing "r\r\n" to the NetworkStream and then call the StreamReader.ReadLine() method on the client side and it throws this exception. What am I doing wrong?

        Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

        R Offline
        R Offline
        Rob Philpott
        wrote on last edited by
        #3

        You're writing "\r\n" to the network stream server side? Are you not using a StreamWriter with WriteLine()?

        Regards, Rob Philpott.

        S 1 Reply Last reply
        0
        • R Rob Philpott

          You're writing "\r\n" to the network stream server side? Are you not using a StreamWriter with WriteLine()?

          Regards, Rob Philpott.

          S Offline
          S Offline
          staticv
          wrote on last edited by
          #4

          Hey guys It wasn't the readline() which was causing the exception :) I figured it out it was the Convert class :) which couldn't convert. Thanks anyways

          Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

          modified on Tuesday, February 10, 2009 12:04 PM

          L 1 Reply Last reply
          0
          • S staticv

            Hey guys It wasn't the readline() which was causing the exception :) I figured it out it was the Convert class :) which couldn't convert. Thanks anyways

            Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

            modified on Tuesday, February 10, 2009 12:04 PM

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            yeah, having two consecutive \r didn't make much sense, did it? one got eaten by ReadLine() as part of Environment.NewLine, and the other was disliked by Convert :-D

            Luc Pattyn [Forum Guidelines] [My Articles]


            - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


            modified on Friday, June 10, 2011 11:39 PM

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups