Networking | 129
var field = document.getElementById("outputField");
field.value += "Invoke : " + event.arguments + "\n";
}
function init( )
{
air.Shell.shell.addEventListener(air.
InvokeEvent.INVOKE,onInvoke);
}
</script>
</head>
<body onload="init( )">
<textarea rows="8" cols="40" id="outputField">
</textarea>
</body>
</html>
Networking
Communicating on a Socket
Problem
You would like to communicate with a server using a proto-
col that is not directly supported by Adobe AIR (for exam-
ple, communicate with an FTP server).
Solution
Use theSocketclass in the AIR API to send binary or text
data to the server and register for events that will alert you to
incoming data from the server.
Discussion
When communicating using protocols other than those
directly supported by Adobe AIR, you may need to use the
Socket API. The Socket API is an asynchronous API that lets