|
|||
|
Hi masters!
Can swfkit socket object connect to an irc server? (like unrealircd) I tryed echoserver (socket bind) and telnet works without error, but when i create new socket and try connect to irc server happened nothing. Thanx for help! |
|
|||
|
Although the socket object can connect to a IRC server, the IRC protocol may be very complex so that it is very hard to write a IRC client in ffish script - at least we do not know how to do that.
We recommend that you call a IRC component or dll in ffish script. It should be much easier than writing a ffish script IRC client. |
|
|||
|
i already write a irc client that use actionscript xml.socket and i find on the internet the WIG php-irc gateway, but cant serve more than 50-60 connection. (becouse gateway)
When i connect to irc directly by swfkit, the gateway not needed and the irc server can serve more connection. i need only the socket write method sample, becouse i dont understand how to send data to an existing socket. I see the file sender sample, but i dont understand the write method. (use something string stream) |
|
|||
|
The ffish script socket object is event-driven. First it connects to a server, and when it is connected, the onConnect event will be triggered. That is to say, the conncet method returns immediately even if the connection has not been established yet. The send method and the receive method are all the same.
In the onConnect event handler, you can send data to the server because the connection has been established. And the send method will return immediately and tell you the bytes that has been written to the system buffer, although the data may not have been sent out. When the data has been sent out, the onSend event will fire - the onSend event tells you that you can send more data now, and in the onSend event handler you can call the send method to send your remain data. The onSend event handler will be called again and again, until all your data has been sent out. To receive data, you must also handle the onReceive event. FFish script uses the StringStream object to send or receive data, which is something like the BinaryArray in Actionscript 3. An advantage of the StringStream object is that it can represent binary data. To send your data to the server, you just need to write the data into a StringStream object and call the send method. |
|
|||
|
I try copy Your Echoserver code sending part and receiving part, but in my fla dont work.
I create new socket, i connect to an irc server (or anything else), and i try sending messages to server. I use the stringstream object. sample: Code:
socket = new Socket;
socket.create();
socket.setEventHandler("onConnect", onConnect);
socket.setEventHandler("onReceive", onRecv);
socket.setEventHandler("onSend", onSend);
function sendtoirc(msg) {
if (socket.sendData.length == 0) {
socket.sendData = new StringStream;
socket.sendData.write(msg);
len = socket.send(socket.sendData, socket.sendData.length);
//mytrace is a dynamic text
_root.mytrace = mytrace+"\n"+len;
}
}
function onSend() {
_root.mytrace = mytrace+"\n Sending process called..";
..sending process, i copyend from echoserver.as
}
function onConnect() {
sendtoirc("NICK something\n");
sendtoirc("USER xzc host localhost :ident\n");
}
socket.connect("10.1.0.1", "6667");
![]() The socket object is difficult for me ![]() |
|
|||
|
Hi!
my program can connect the server, and can receive data. but the send method doesnt work ![]() the on send event triggered when connected. but i not send data on onConnect event. i create input textbox and a send button. When i write some data to input text and press sendbtn the send method returns len value, but the onSend evend not fired again. Why? Thanks! |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|