You have limited ability to determine if there is something listening on the other hand using DSR / DTR pins.
When you open the serial port on the computer on which your scripts are running, it should raise its DTR output (or you must convince it of this: the library documentation that you use to control the COM port should indicate how).
, Arduino, DSR (, - , DTR DSR + CD Arduino) , " ", , .
, script , / , DTR , - . , script Arduino - .
always - : , , ( ).
( , DSR ), , .