Click here to Skip to main content
16,005,141 members
Home / Discussions / C#
   

C#

 
GeneralRe: Specified argument was out of the range of valid values Pin
Scott Dorman26-Sep-07 8:19
professionalScott Dorman26-Sep-07 8:19 
GeneralRe: Specified argument was out of the range of valid values Pin
Rukmini T26-Sep-07 8:42
Rukmini T26-Sep-07 8:42 
GeneralRe: Specified argument was out of the range of valid values Pin
Scott Dorman26-Sep-07 9:44
professionalScott Dorman26-Sep-07 9:44 
GeneralRe: Specified argument was out of the range of valid values Pin
Pete O'Hanlon26-Sep-07 9:42
mvePete O'Hanlon26-Sep-07 9:42 
GeneralRe: Specified argument was out of the range of valid values Pin
Scott Dorman26-Sep-07 9:45
professionalScott Dorman26-Sep-07 9:45 
Questionimage column Pin
TAREQ F ABUZUHRI26-Sep-07 6:42
TAREQ F ABUZUHRI26-Sep-07 6:42 
AnswerRe: image column Pin
Guffa26-Sep-07 7:02
Guffa26-Sep-07 7:02 
QuestionNetworkStream.DataAvailable is always false [modified] Pin
Anthony Mushrow26-Sep-07 6:34
professionalAnthony Mushrow26-Sep-07 6:34 
Dead | X|

It wasn't much of a problem... infact, i didn't even know DataAvailable was there. But in my app you can download files from one PC to another accross a NetworkStream. Ive just added in the part where you cancel the download, and both client and server stop and go back to whatever they where doing, all good.

But, next time i try to read from the stream for whatever reason, i get whatever crap was left over from the file transfer that wasn't read earlier. This is when i found out about DataAvailable and i thought, great, so i can just read off the rest of the data from the stream when i cancel the download, and THEN carry on doing other stuff. Only problem is, it always returns with false.

Now, i know the code i use for downloading works perfectly, so i added in a line to check if there was any data on the stream just before i actually read it anyway. It said there wasn't, then it read the data and added it to the rest of the file. D'Oh! | :doh:

Have i gotten confused somewhere? It should return true if there is data in the stream, right?

The stream gets created like this:

TcpClient tcpClient = new TcpClient();<br />
tcpClient.Connect(Address, Port);<br />
NetworkStream TransferStream = tcpClient.GetStream();



-- modified at 12:40 Wednesday 26th September, 2007

Dude... what?
Okay, so i think to myself, fine, i'll just make and connect the socket myself, then make a new stream from the socket. More line of code but y'know.
Anyways, now DataAvailable returns true.

So, the question becomes:

Why can't you use DataAvailable (and who knows what else) on a stream you got from a TcpClient?
QuestionRe: NetworkStream.DataAvailable is only true once Pin
Anthony Mushrow26-Sep-07 6:57
professionalAnthony Mushrow26-Sep-07 6:57 
QuestionPhoto Gallery Pin
ddtayl0626-Sep-07 6:34
ddtayl0626-Sep-07 6:34 
AnswerRe: Photo Gallery Pin
Pete O'Hanlon26-Sep-07 10:10
mvePete O'Hanlon26-Sep-07 10:10 
QuestionException when Running a Process [modified] Pin
#realJSOP26-Sep-07 5:56
professional#realJSOP26-Sep-07 5:56 
AnswerRe: Exception when Running a Process Pin
Scott Dorman26-Sep-07 6:36
professionalScott Dorman26-Sep-07 6:36 
AnswerRe: Exception when Running a Process Pin
Justin Perez26-Sep-07 6:56
Justin Perez26-Sep-07 6:56 
GeneralRe: Exception when Running a Process Pin
#realJSOP26-Sep-07 8:10
professional#realJSOP26-Sep-07 8:10 
AnswerRe: Exception when Running a Process Pin
markkuk26-Sep-07 9:14
markkuk26-Sep-07 9:14 
QuestionIBM "Packed Decimal" To .NET "String" Conversion Pin
Shahin7726-Sep-07 5:36
Shahin7726-Sep-07 5:36 
AnswerRe: IBM "Packed Decimal" To .NET "String" Conversion Pin
Scott Dorman26-Sep-07 6:35
professionalScott Dorman26-Sep-07 6:35 
GeneralRe: IBM "Packed Decimal" To .NET "String" Conversion Pin
Pete O'Hanlon26-Sep-07 10:05
mvePete O'Hanlon26-Sep-07 10:05 
GeneralRe: IBM "Packed Decimal" To .NET "String" Conversion Pin
Scott Dorman26-Sep-07 10:19
professionalScott Dorman26-Sep-07 10:19 
QuestionBase64 strings Pin
nemo26-Sep-07 5:16
nemo26-Sep-07 5:16 
AnswerRe: Base64 strings Pin
BoneSoft26-Sep-07 5:55
BoneSoft26-Sep-07 5:55 
AnswerRe: Base64 strings Pin
Scott Dorman26-Sep-07 6:43
professionalScott Dorman26-Sep-07 6:43 
QuestionWriting column names in Excel file Pin
topksharma198226-Sep-07 4:34
topksharma198226-Sep-07 4:34 
AnswerRe: Writing column names in Excel file Pin
Justin Perez26-Sep-07 4:57
Justin Perez26-Sep-07 4:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.