KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

KixIRC client

 
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion
View previous topic :: View next topic  
Author Message
Bryce
KiXforms Supporter
KiXforms Supporter


Joined: 26 Mar 2003
Posts: 69

PostPosted: Sun Nov 14, 2004 7:45 pm    Post subject: KixIRC client Reply with quote

got to playing around..,.. and i had an idea... how about a KiXforms IRC client??!!

only problem is.... it seens that kixforms stops handling $socket.onreceive events after the initial hand shake....

for example.... using a telnet prompt....

telnet to irc.slashdot.org 6667
type in NICK bryce
user bryce flag20 irc.sladsog.org :bryce

if you get a PING you have to reply with a PONG with the number that was given with the ping...

once you are authenticated to the server, a LARGE MOTD is sent down to the client....


asfter some testing, it seems that kixforms is stoping the $socket.onreceive events after the first SEND command........ any ideas on why this is?

in the below script, you can connect to the server, and send any command that you want, but only the first is triggering a $socket.onreceive event.

Code:

break on
$ = setoption("novarsinstrings","on")

$system = createobject("kixtart.system")

$Server = "irc.slashdot.org"
$PORT = 6667
$nick = "Bryce"

;KD START

;************* Form **************
$Form = $System.Form()
$Form.Height = 335
$Form.Left = 32
$Form.Text = "KiXforms Designer Template"
$Form.Top = 4
$Form.Width = 468
;**************************************

;************* Display **************
$Display = $Form.Controls.ListBox()
$Display.Height = 238
$Display.Left = 0
$Display.Top = 0
$Display.Width = 456
;**************************************

;************* sendtext **************
$sendtext = $Form.Controls.TextBox()
$sendtext.Height = 20
$sendtext.Left = 0
$sendtext.Text = ""
$sendtext.Top = 240
$sendtext.Width = 353
;**************************************

;************* Send **************
$Send = $Form.Controls.Button()
$Send.Height = 23
$Send.Left = 360
$Send.Text = "Send"
$Send.Top = 240
$Send.Width = 75
$Send.OnClick = "send($sendtext.text) $sendtext.text=''"
;**************************************

;************* B_Connect **************
$B_Connect = $Form.Controls.Button()
$B_Connect.Height = 23
$B_Connect.Left = 120
$B_Connect.Text = "Connect"
$B_Connect.Top = 270
$B_Connect.Width = 75
$B_Connect.OnClick = "connect()"
;**************************************

;************* B_DisConnect **************
$B_DisConnect = $Form.Controls.Button()
$B_DisConnect.Height = 23
$B_DisConnect.Left = 250
$B_DisConnect.Text = "Disconnect"
$B_DisConnect.Top = 270
$B_DisConnect.Width = 75
$B_DisConnect.OnClick = "Disconnect()"
;**************************************


;KD END


$Form.Show

while $form.visible
   $=execute($form.doevents)
loop


function connect()
   $socket = $system.socket()
   if $socket
      $socket.blocking = 0
      $socket.onconnect = "onconnect($system.eventobject)"
      $socket.onreceive = "onreceive($system.eventobject)"
      $socket.ondisconnect = "ondisconnect($system.eventobject)"
      $socket.remoteaddress = $server
      $socket.remoteport = $port
      $socket.connect()
   endif
endfunction

function onconnect($socket)
   if $system.error
      $= $system.messagebox.show($system.serror)
      return
   endif

   if $socket
      ;send handshake
      ;send("NICK " + $nick)
      ;send("USER " + $nick + " " + @wksta + " " + $server + " :" + $nick)

   endif
endfunction

function disconnect()
   if $socket
      send("quit")
      $socket.disconnect()
      $socket.close()
      $socket = 0
   endif
endfunction

function onreceive($socket)
   if $system.error
      $= $system.messagebox.show($system.serror)
      return
   endif

   ? "Processing data"
   if $socket
      $data = $socket.receive()
      ;? len($data)
      $data = split($data,@crlf)
      for $i = 0 to ubound($data)-1
         ;? "<<" $data[$i]
         $display.additem("<<<" + $data[$i])
         select
            ;case split($data[$i],":")[2] = "*** No ident response; username prefixed with ~"
            ;   send("NICK " + $nick)
            ;   send("USER " + $nick + " " + @wksta + " " + $server + " :" + $nick)
            ;case split($data[$i],":")[0] = "PING "
               ;send("pong " + split($data[$i],":")[1])
         endselect
      next
   endif
endfunction

function send(optional $data)
   if $socket
      $display.additem(">>>"+$data)
      $socket.send($data+chr(13)+chr(10))
   endif
endfunction

function ondisconnect($socket)
   $= $system.messagebox.show($system.serror)
endfunction
Back to top
View user's profile Send private message
Bryce
KiXforms Supporter
KiXforms Supporter


Joined: 26 Mar 2003
Posts: 69

PostPosted: Sun Nov 14, 2004 7:46 pm    Post subject: Reply with quote

after even more testing....

it is not the $socket.onreceive that stops working.... it is the $socket.send that stops working after the first .send command!

if you sit connected long enought you will time out and you see it on screen

Bryce
Back to top
View user's profile Send private message
Bonji
KiXforms Aficionado
KiXforms Aficionado


Joined: 10 Mar 2003
Posts: 393
Location: Virginia

PostPosted: Mon Nov 15, 2004 1:21 pm    Post subject: Reply with quote

This is very similar to a problem that I am still experiencing with one major exception: your problem is consistant. My problem happens only randomly, and I can't figure out any pattern to it.
_________________
-Ben
Back to top
View user's profile Send private message
Bryce
KiXforms Supporter
KiXforms Supporter


Joined: 26 Mar 2003
Posts: 69

PostPosted: Mon Nov 15, 2004 4:03 pm    Post subject: Reply with quote

ok... i may be onto something...

port numbers!!

it has something to do with the port number that we are connecting to.

take my above code... and edit the $server and $port to point at a mail server on 110... hit connect. send any command, and you will get a error returned... i was able to get the pop3 mail server return 30+ errors before i hit disconnect and a "QUIT" was sent to the mail server and i lost connection.

Now.... use the original settings for a IRC server... $server = "irc.slashdot.org" $port = 6667 send any command and you should get an error.... but after the first send command... all other send commands do not work. and if you wait long enough you will see a timeout event happen from the irc server
Back to top
View user's profile Send private message
Bonji
KiXforms Aficionado
KiXforms Aficionado


Joined: 10 Mar 2003
Posts: 393
Location: Virginia

PostPosted: Mon Nov 15, 2004 4:44 pm    Post subject: Reply with quote

This might be more related to data versus port numbers. I wrote a nifty little client/server script that lets me perform socket testing, and I tried ports 110 and 6667 and did not have any problems with either. I believe the problems I experience are related to data, however I haven't nailed down how so yet. I can make my script break with little data sent quickly or large data sent quickly, or little/large data sent sporadically.

If you're interested in this script just let me know and I'll post. It contains a server and two clients on one form. Each client can connect independently and send to the server independently. The server can send a message to all connected clients. And I have a button to make both clients send a message (that are numbered) to the server at the same time.

This has been a major problem for me because I cannot assume the data gets sent to/from server/client, so I have had to add error checking to verify the packet was received. If not received, then it has to reset the connection because that is the only way to recover.

Ramble Ramble Ramble...

_________________
-Ben
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Nov 15, 2004 6:23 pm    Post subject: Reply with quote

bryce - msn when you get a chance
Back to top
View user's profile Send private message
Bryce
KiXforms Supporter
KiXforms Supporter


Joined: 26 Mar 2003
Posts: 69

PostPosted: Tue Nov 16, 2004 4:32 pm    Post subject: Reply with quote

how to authenticate to a IRC server by using a telnet prompt.

from a command line.

telnet irc.slashdot.org 6667

depending on the server, you may or may not get a welcome message.

once you are connected to a IRC server, you need to establish a session. to do that type

NICK <your nick name>
USER <your nick name> <your comptuer name> <the server that you connected to> :<your full name>

once you are authenticated to the server, the server will display something like the following...

Code:

:vortex.slashnet.org 001 bryce :Welcome to the SlashNET IRC Network bryce!~bryce@h-68-165-147-10.hstqtx02.covad.net
:vortex.slashnet.org 002 bryce :Your host is vortex.slashnet.org, running version Unreal3.2+(debug)
:vortex.slashnet.org 003 bryce :This server was created Thu May 27 2004 at 00:09:41 EST
:vortex.slashnet.org 004 bryce vortex.slashnet.org Unreal3.2+(debug) iowghraAsORTVSxNCWqBzvdHtGp lvhopsmntikrRcaqOALQbSeKVfMGCuzNT
:vortex.slashnet.org 005 bryce MAP KNOCK SAFELIST HCN MAXCHANNELS=20 MAXBANS=60 NICKLEN=30 TOPICLEN=307 KICKLEN=307 MAXTARGETS=20 AWAYLEN=307 :are supported by t
:vortex.slashnet.org 005 bryce WALLCHOPS WATCH=128 SILENCE=15 MODES=12 CHANTYPES=# PREFIX=(ohv)@%+ CHANMODES=beqa,kfL,l,psmntirRcOAQKVGCuzNSMT NETWORK=SlashNET C
:vortex.slashnet.org 251 bryce :There are 1435 users and 723 invisible on 8 servers
:vortex.slashnet.org 252 bryce 22 :operator(s) online
:vortex.slashnet.org 254 bryce 409 :channels formed
:vortex.slashnet.org 255 bryce :I have 168 clients and 1 servers
:vortex.slashnet.org 265 bryce :Current Local Users: 168  Max: 500
:vortex.slashnet.org 266 bryce :Current Global Users: 2158  Max: 2536
:vortex.slashnet.org 375 bryce :- vortex.slashnet.org Message of the Day -
:vortex.slashnet.org 372 bryce :- 8/6/2004 2:43
:vortex.slashnet.org 372 bryce :- This is the short MOTD. To view the complete MOTD type /motd
:vortex.slashnet.org 372 bryce :-
:vortex.slashnet.org 372 bryce :-  Welcome to the ☻SlashNET IRC Network☻ - http://slashnet.org/
:vortex.slashnet.org 372 bryce :-
:vortex.slashnet.org 372 bryce :-  Hostname: vortex.slashnet.org / stormtrooper.enumerati.org
:vortex.slashnet.org 372 bryce :-  Available Ports: 6667 (Non-SSL)/6697 (☻SSL☻ by CACert)
:vortex.slashnet.org 372 bryce :-
:vortex.slashnet.org 372 bryce :-  Vortex is located in sunny Hobart on Constitution Dock
:vortex.slashnet.org 372 bryce :-  in Tasmania, Australia.  Tasmania - Your natural state.
:vortex.slashnet.org 372 bryce :-
:vortex.slashnet.org 372 bryce :-  This server is graciously colocated by KeyPoint
:vortex.slashnet.org 372 bryce :-  http://www.keypoint.com.au/ - Intelligent Internet
:vortex.slashnet.org 372 bryce :-
:vortex.slashnet.org 372 bryce :-  Harmful bots and botnets are strictly prohibited.
:vortex.slashnet.org 372 bryce :-  No more then 3 connections per user even from multiple hosts.
:vortex.slashnet.org 372 bryce :-
:vortex.slashnet.org 372 bryce :-  ☻Please read the conditions of usage which can be found☻
:vortex.slashnet.org 372 bryce :-  ☻by typing /motd at any time.☻
:vortex.slashnet.org 372 bryce :-
:vortex.slashnet.org 372 bryce :-  ☻Information on the SlashNET IRCd upgrade can be found☻
:vortex.slashnet.org 372 bryce :-  ☻at http://www.slashnet.org/upgrading.php☻
:vortex.slashnet.org 372 bryce :-
:vortex.slashnet.org 372 bryce :-  Cloak by typing /mode <nick> +x where <nick> is your
:vortex.slashnet.org 372 bryce :-  current nickname.
:vortex.slashnet.org 372 bryce :-
:vortex.slashnet.org 372 bryce :-  Server Staff
:vortex.slashnet.org 372 bryce :-         Admin:    acb           <acb at slashnet.org>
:vortex.slashnet.org 372 bryce :-         Co-Admin: Net_Fish <Net_Fish at slashnet.org>
:vortex.slashnet.org 372 bryce :-  Server Cabal
:vortex.slashnet.org 372 bryce :-         drdink, jwbozzy, jeff, Kyle, Gullie, oneiros
:vortex.slashnet.org 372 bryce :-  $Id: ircd.smotd,v 1.6 2004/06/07 16:43:20 unreal Exp $
:vortex.slashnet.org 372 bryce :-
:vortex.slashnet.org 376 bryce :End of /MOTD command.
:bryce MODE bryce :+x


important, the server will send you a PING request once every few minutes... if you fail to reply to the ping request the server will drop your connection (ping timeout)

here it eh ping request
Code:

PING :vortex.slashnet.org


to reply... type "pong vortex.slashnet.org"

You can now use raw IRC commands to join channels here is my joining the channel #kixtart with a telnet prompt, i then use a 3rd party IRC client to join the channel with the nick Isorg.

Code:

join #kixtart
:bryce!~bryce@cloak-3BFAA380.hstqtx02.covad.net JOIN :#kixtart
:vortex.slashnet.org MODE #kixtart +nt
:vortex.slashnet.org 353 bryce = #kixtart :@bryce
:vortex.slashnet.org 366 bryce #kixtart :End of /NAMES list.
:Isorg!~isorg@cloak-3BFAA380.hstqtx02.covad.net JOIN :#kixtart
:Isorg!~isorg@cloak-3BFAA380.hstqtx02.covad.net PRIVMSG #kixtart :hi bryce!!
:Isorg!~isorg@cloak-3BFAA380.hstqtx02.covad.net PRIVMSG #kixtart :this is me talking to my self in the #kixtart chann on irc.slashdot.org
privmsg #kixtart hello Isorg!
:Isorg!~isorg@cloak-3BFAA380.hstqtx02.covad.net PART #kixtart :activating the /leave command
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Tue Nov 16, 2004 11:47 pm    Post subject: Reply with quote

When I enter a nick, says I am not registered ... how do I register ?
Back to top
View user's profile Send private message
Bryce
KiXforms Supporter
KiXforms Supporter


Joined: 26 Mar 2003
Posts: 69

PostPosted: Wed Nov 17, 2004 3:25 pm    Post subject: Reply with quote

shawn is able to repo the problem now Smile
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Wed Nov 17, 2004 4:41 pm    Post subject: Reply with quote

ja i see it ... not sure what's going on though ... do you have a link to any readers digest version of the IRC protocol kicking around ? Not talking about those long-winded RFC-type thingies, just a plain and simple one ?
Back to top
View user's profile Send private message
Bryce
KiXforms Supporter
KiXforms Supporter


Joined: 26 Mar 2003
Posts: 69

PostPosted: Wed Nov 17, 2004 6:05 pm    Post subject: Reply with quote

let me look.
Back to top
View user's profile Send private message
Bryce
KiXforms Supporter
KiXforms Supporter


Joined: 26 Mar 2003
Posts: 69

PostPosted: Wed Nov 17, 2004 7:15 pm    Post subject: Reply with quote

well,

there is this.

http://www.irchelp.org/irchelp/rfc/chapter2.html

Quote:

No specific character set is specified. The protocol is based on a a set of codes which are composed of eight (8) bits, making up an octet. Each message may be composed of any number of these octets; however, some octet values are used for control codes which act as message delimiters.

Regardless of being an 8-bit protocol, the delimiters and keywords are such that protocol is mostly usable from USASCII terminal and a telnet connection.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group