Click here to Skip to main content
15,881,803 members
Home / Discussions / C#
   

C#

 
AnswerRe: Socket is suddenly closed Pin
BobJanova3-May-11 1:31
BobJanova3-May-11 1:31 
GeneralRe: Socket is suddenly closed Pin
jschell3-May-11 8:29
jschell3-May-11 8:29 
GeneralRe: Socket is suddenly closed Pin
BobJanova3-May-11 9:16
BobJanova3-May-11 9:16 
GeneralRe: Socket is suddenly closed Pin
jschell4-May-11 8:13
jschell4-May-11 8:13 
GeneralRe: Socket is suddenly closed Pin
toploader3-May-11 10:17
toploader3-May-11 10:17 
GeneralRe: Socket is suddenly closed Pin
BobJanova3-May-11 10:36
BobJanova3-May-11 10:36 
GeneralRe: Socket is suddenly closed Pin
toploader3-May-11 11:59
toploader3-May-11 11:59 
QuestionFile being used by another process? I don't think so! Pin
SimpleData1-May-11 8:52
SimpleData1-May-11 8:52 
Hi,
I am trying to code an application which reads some data from a NetworkStream, saves it into a buffer byte array and then appending it to a file.

Here is the part I am writing the data from the byte array into the file:
FileStream fs = new FileStream(last_save_location, FileMode.Append, FileAccess.Write);
fs.Write(message, 8, bytesRead - 8);
fs.Close();
fs.Dispose();


Everything seems to function fine. I can write the data from NetworkStream to the buffer byte array and then into the file for a while. However, after some time, I get the following error:
The process cannot access the file 'C:\Users\Main\Desktop\test.bin' because it is being used by another process.


I am quite sure that no other process is using the file and that I close the handle each and every time. What do you think the problem is?

Regards,
Can
AnswerRe: File being used by another process? I don't think so! Pin
Luc Pattyn1-May-11 9:04
sitebuilderLuc Pattyn1-May-11 9:04 
GeneralRe: File being used by another process? I don't think so! Pin
SimpleData1-May-11 9:10
SimpleData1-May-11 9:10 
GeneralRe: File being used by another process? I don't think so! Pin
DaveyM691-May-11 9:16
professionalDaveyM691-May-11 9:16 
GeneralRe: File being used by another process? I don't think so! Pin
SimpleData1-May-11 9:22
SimpleData1-May-11 9:22 
AnswerRe: File being used by another process? I don't think so! Pin
Luc Pattyn1-May-11 9:21
sitebuilderLuc Pattyn1-May-11 9:21 
GeneralRe: File being used by another process? I don't think so! Pin
SimpleData1-May-11 9:25
SimpleData1-May-11 9:25 
AnswerRe: File being used by another process? I don't think so! Pin
Luc Pattyn1-May-11 9:52
sitebuilderLuc Pattyn1-May-11 9:52 
GeneralRe: File being used by another process? I don't think so! Pin
lukeer1-May-11 21:22
lukeer1-May-11 21:22 
AnswerRe: File being used by another process? I don't think so! Pin
I Believe In GOD1-May-11 9:12
I Believe In GOD1-May-11 9:12 
AnswerRe: File being used by another process? I don't think so! Pin
BobJanova3-May-11 1:33
BobJanova3-May-11 1:33 
Questionsaving values in forms of c# Pin
aeman1-May-11 2:03
aeman1-May-11 2:03 
AnswerRe: saving values in forms of c# Pin
DaveyM691-May-11 2:12
professionalDaveyM691-May-11 2:12 
GeneralRe: saving values in forms of c# Pin
aeman1-May-11 2:27
aeman1-May-11 2:27 
GeneralRe: saving values in forms of c# Pin
DaveyM691-May-11 4:34
professionalDaveyM691-May-11 4:34 
AnswerRe: saving values in forms of c# Pin
I Believe In GOD1-May-11 2:28
I Believe In GOD1-May-11 2:28 
GeneralRe: saving values in forms of c# Pin
aeman1-May-11 2:56
aeman1-May-11 2:56 
GeneralRe: saving values in forms of c# Pin
I Believe In GOD1-May-11 2:58
I Believe In GOD1-May-11 2:58 

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.