-
socket communication
For socket communication, I better use an external script instead of adding the script to the 1st frame in the movie??
since otherwise, if the movie keep looping, I will try to open many many socket then?
from what version of flash support external script? (.as)
import ftk.net.BufferedSocket;
BufferedSocketExample();
function BufferedSocketExample() {
trace('start...');
var socket:BufferedSocket = new BufferedSocket('127.0.0.1', 12345);
socket.onConnect = function() {
trace('connected');
};
socket.onFailure = function() {
trace('failure');
};
socket.onTimeout = function() {
trace('timeout');
};
socket.onClose = function() {
trace('close');
};
socket.onData = function(d) {
trace('data: '+d);
};
socket.connect();
for (var i:Number = 0; i<10; i++) {
socket.send('msg-'+i);
}//~ socket.close();
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|