473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

End of file

Hi
When I read from a file through a binaryReader, how can I know when the end
of the file is reached?
thanks
Nov 16 '05 #1
5 1583
Michael <Mi*****@discussions.microsoft.com> wrote:
When I read from a file through a binaryReader, how can I know when
the end of the file is reached?


That depends on how you're reading it - what exactly are you doing with
it? (Also, do you definitely need a BinaryReader? I've seen a lot of
people using them when they really only need a stream. Just a thought.)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
I want to read bytes from a file to send them over the internet to another
computer.

Nov 16 '05 #3
I would just use the NetworkStream stream or the socket directly and read
until bytesToRead is read or 0 is returned from read(). You should send the
len first or in some fixed len header so you know how many bytes are coming.
Another good reason for this information upfront is you may want to reject
the request for a 3+GB upload or for some other reasons (i.e. no space,
wrong name, wrong secret, etc).

--
William Stacey, MVP
http://mvp.support.microsoft.com

"Michael" <Mi*****@discussions.microsoft.com> wrote in message
news:C4**********************************@microsof t.com...
I want to read bytes from a file to send them over the internet to another
computer.


Nov 16 '05 #4
What is the NetworkStream and how can I use it to send files over the
internet??
thanks for ur help

"William Stacey [MVP]" wrote:
I would just use the NetworkStream stream or the socket directly and read
until bytesToRead is read or 0 is returned from read(). You should send the
len first or in some fixed len header so you know how many bytes are coming.
Another good reason for this information upfront is you may want to reject
the request for a 3+GB upload or for some other reasons (i.e. no space,
wrong name, wrong secret, etc).

--
William Stacey, MVP
http://mvp.support.microsoft.com

"Michael" <Mi*****@discussions.microsoft.com> wrote in message
news:C4**********************************@microsof t.com...
I want to read bytes from a file to send them over the internet to another
computer.


Nov 16 '05 #5
The doco is pretty good on it. Lookup NetworkStream class in msdn.

--
William Stacey, MVP
http://mvp.support.microsoft.com

"Michael" <Mi*****@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com...
What is the NetworkStream and how can I use it to send files over the
internet??
thanks for ur help

"William Stacey [MVP]" wrote:
I would just use the NetworkStream stream or the socket directly and read until bytesToRead is read or 0 is returned from read(). You should send the len first or in some fixed len header so you know how many bytes are coming. Another good reason for this information upfront is you may want to reject the request for a 3+GB upload or for some other reasons (i.e. no space,
wrong name, wrong secret, etc).

--
William Stacey, MVP
http://mvp.support.microsoft.com

"Michael" <Mi*****@discussions.microsoft.com> wrote in message
news:C4**********************************@microsof t.com...
I want to read bytes from a file to send them over the internet to another computer.



Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
5
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
18
by: Dino | last post by:
dear all, i've created an application for a customer where the customer can upload ..csv-files into a specified ftp-directory. on the server, a php-script, triggered by a cronjob, reads all the...
0
by: chris | last post by:
I'm writing a small app to help me learn more about cryptography. All it does is encrypt all of the files in directory A, and put the encrypted versions of the files in directory B. It then...
5
by: simon place | last post by:
is the code below meant to produce rubbish?, i had expected an exception. f=file('readme.txt','w') f.write(' ') f.read() ( PythonWin 2.3 (#46, Jul 29 2003, 18:54:32) on win32. ) I got...
7
by: Joseph | last post by:
Hi, I'm having bit of questions on recursive pointer. I have following code that supports upto 8K files but when i do a file like 12K i get a segment fault. I Know it is in this line of code. ...
3
by: StGo | last post by:
How can i read/write file's custom attributs(like subject,author...) in C#??? Thanks :))
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
1
by: Mika M | last post by:
I have made Setup and Deployment Project for my application. This application uses couble of Crysral Report .rpt -files, so I included following into Setup and Deployment Project ... -...
0
by: thjwong | last post by:
I'm using WinXP with Microsoft Visual C++ .NET 69462-006-3405781-18776, Microsoft Development Environment 2003 Version 7.1.3088, Microsoft .NET Framework 1.1 Version 1.1.4322 SP1 Most developers...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.