Click here to Skip to main content
16,006,885 members
Home / Discussions / C#
   

C#

 
AnswerRe: Localization Project Pin
Pixinger7715-May-06 21:58
Pixinger7715-May-06 21:58 
AnswerRe: Localization Project Pin
lmoelleb15-May-06 22:06
lmoelleb15-May-06 22:06 
QuestionNeed urgent help Pin
ass3aad15-May-06 5:55
ass3aad15-May-06 5:55 
AnswerRe: Need urgent help Pin
Judah Gabriel Himango15-May-06 6:14
sponsorJudah Gabriel Himango15-May-06 6:14 
GeneralRe: Need urgent help Pin
ass3aad15-May-06 6:46
ass3aad15-May-06 6:46 
GeneralRe: Need urgent help Pin
Judah Gabriel Himango15-May-06 8:24
sponsorJudah Gabriel Himango15-May-06 8:24 
GeneralRe: Need urgent help Pin
Dave Kreskowiak15-May-06 14:30
mveDave Kreskowiak15-May-06 14:30 
QuestionFile.Delete() fails (Access rights required???) Pin
Shy Agam15-May-06 5:16
Shy Agam15-May-06 5:16 
Hi,

I'm sending data from my server app to my client app via TCP socketing...
The data I send is the content of a file, which I know is not larger than 8k.
Thus I fit the entire file content into one pack.

This is my function which handles incomming data, and writes it to the file(Buffer and Pack are classes written by me):
private void myDataArrivalFunction(Buffer bf)
{
    while (bf.PacksCount > 0)
    {
        Pack p = bf.GetNextPack();

        string fileName = "blablabla the path to my file";


        /* Some checks and other stuff */


        File.WriteAllBytes(fileName, p.Data);
        Application.DoEvents();
                

        /* Analyze the new file */

        try
        {
            File.Delete(fileName);
        }
        catch (Exception ex)
        {
            /* Nofify UI */
        }
    }
}

Once the file has been opened once, File.Delete() fails, saying the file is being used by another process.

I originally used a FileStream object and tried to gain some additional access rights and stuff, but nothing worked.
Even after closing the FileStream object I received the same exception.

Any ideas? Confused | :confused:

-- modified at 11:16 Monday 15th May, 2006
AnswerRe: File.Delete() fails (Access rights required???) Pin
leppie15-May-06 5:27
leppie15-May-06 5:27 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Shy Agam15-May-06 6:15
Shy Agam15-May-06 6:15 
AnswerRe: File.Delete() fails (Access rights required???) Pin
Judah Gabriel Himango15-May-06 6:25
sponsorJudah Gabriel Himango15-May-06 6:25 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Shy Agam15-May-06 7:25
Shy Agam15-May-06 7:25 
AnswerRe: File.Delete() fails (Access rights required???) Pin
Guffa15-May-06 7:57
Guffa15-May-06 7:57 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Shy Agam15-May-06 8:38
Shy Agam15-May-06 8:38 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Dan Neely15-May-06 8:52
Dan Neely15-May-06 8:52 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Shy Agam16-May-06 7:41
Shy Agam16-May-06 7:41 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Judah Gabriel Himango15-May-06 8:13
sponsorJudah Gabriel Himango15-May-06 8:13 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Shy Agam15-May-06 8:31
Shy Agam15-May-06 8:31 
GeneralRe: File.Delete() fails (Access rights required???) Pin
Judah Gabriel Himango15-May-06 10:10
sponsorJudah Gabriel Himango15-May-06 10:10 
AnswerRe: File.Delete() fails (Access rights required???) Pin
Shy Agam15-May-06 8:48
Shy Agam15-May-06 8:48 
QuestionContextMenu + NotifyIcon + LEFT Click Problem Pin
Phoen2515-May-06 4:59
Phoen2515-May-06 4:59 
AnswerRe: ContextMenu + NotifyIcon + LEFT Click Problem Pin
NaNg1524115-May-06 6:46
NaNg1524115-May-06 6:46 
GeneralRe: ContextMenu + NotifyIcon + LEFT Click Problem Pin
Phoen2515-May-06 7:48
Phoen2515-May-06 7:48 
GeneralRe: ContextMenu + NotifyIcon + LEFT Click Problem Pin
Nader Elshehabi15-May-06 12:56
Nader Elshehabi15-May-06 12:56 
GeneralRe: ContextMenu + NotifyIcon + LEFT Click Problem Pin
Phoen2516-May-06 4:03
Phoen2516-May-06 4:03 

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.