Highlighted

How to know fast if another computer is accesible in a LAN AS3 (Adobe Air)

New Here ,
Jun 16, 2015

Copy link to clipboard

Copied

I'm using FileStream to read files in two computers that are connected in a Local Area Network (LAN). I have no problem to read the files when the others computers are connected. I'm checking if the directory exists before writing the file I'm checking if the directory AND the file exists before reading the file.

file_pc1 = new File("//OTHER-PC/Folder/file.csv"); 
directory = new File("//OTHER-PC/Folder");
if (directory_pc1.exists)
{
     stream.open(file_pc1, FileMode.WRITE);
     stream.writeUTFBytes(csv.data);
     stream.close();
}
if (directory_pc1.exists && file_pc1.exists)
{
     stream.open(file_pc1, FileMode.READ);
     stream.writeUTFBytes(csv.data);
     stream.close();
}

All this works great but if the other computer is not connected, the statements directory_pc1.exists and file_pc1.exists takes a very long time and the app freezes, sometime even sending the "Application is not responding" message from Windows, but it finally responds after a long time.

Is there a fastest way to check if i'm connected to another PC?

TOPICS
Development

Views

175

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to know fast if another computer is accesible in a LAN AS3 (Adobe Air)

New Here ,
Jun 16, 2015

Copy link to clipboard

Copied

I'm using FileStream to read files in two computers that are connected in a Local Area Network (LAN). I have no problem to read the files when the others computers are connected. I'm checking if the directory exists before writing the file I'm checking if the directory AND the file exists before reading the file.

file_pc1 = new File("//OTHER-PC/Folder/file.csv"); 
directory = new File("//OTHER-PC/Folder");
if (directory_pc1.exists)
{
     stream.open(file_pc1, FileMode.WRITE);
     stream.writeUTFBytes(csv.data);
     stream.close();
}
if (directory_pc1.exists && file_pc1.exists)
{
     stream.open(file_pc1, FileMode.READ);
     stream.writeUTFBytes(csv.data);
     stream.close();
}

All this works great but if the other computer is not connected, the statements directory_pc1.exists and file_pc1.exists takes a very long time and the app freezes, sometime even sending the "Application is not responding" message from Windows, but it finally responds after a long time.

Is there a fastest way to check if i'm connected to another PC?

TOPICS
Development

Views

176

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 16, 2015 0
Advocate ,
Jun 16, 2015

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 16, 2015 0
Community Beginner ,
Jun 18, 2015

Copy link to clipboard

Copied

Please, view my post, may be can use this tip: https://forums.adobe.com/thread/1876631

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 18, 2015 0