Skip to main content
Jacowaco
Participant
June 16, 2015
Question

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

  • June 16, 2015
  • 2 replies
  • 302 views

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?

This topic has been closed for replies.

2 replies

jaimeMéndez10285094
Participant
June 19, 2015

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