Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-15-2007, 04:46 AM
Junior Member
 
Join Date: Jan 2007
Posts: 13
Default Socket obj and IRC

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!
Reply With Quote
  #2 (permalink)  
Old 01-15-2007, 10:57 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Socket obj and IRC

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.
Reply With Quote
  #3 (permalink)  
Old 01-15-2007, 03:05 PM
Junior Member
 
Join Date: Jan 2007
Posts: 13
Default Re:Socket obj and IRC

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)


Reply With Quote
  #4 (permalink)  
Old 01-16-2007, 03:22 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Socket obj and IRC

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.
Reply With Quote
  #5 (permalink)  
Old 01-17-2007, 06:37 AM
Junior Member
 
Join Date: Jan 2007
Posts: 13
Default Re:Socket obj and IRC

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");
But when call sendtoirc the len value is undefined, and the onSend function dont run.
The socket object is difficult for me
Reply With Quote
  #6 (permalink)  
Old 01-25-2007, 10:02 AM
Junior Member
 
Join Date: Jan 2007
Posts: 13
Default Re:Socket obj and IRC

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!
Reply With Quote
  #7 (permalink)  
Old 01-27-2007, 11:37 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Socket obj and IRC

If the data has been sent by one "send" call, the onSend event may not be triggered.
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:03 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.