mIRC Home    About    Download    Register    News    Help

Print Thread
#125409 17/07/05 10:05 PM
Joined: Sep 2004
Posts: 73
S
SteeleR Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Sep 2004
Posts: 73
CLIENT
.code]
alias irczzz {
set %zzz.server SERVERNICK
set %zzz.username $$?="Enter username: "
var %zzz.password = $$?="Enter password: "
.notice %zzz.server connect %zzz.username %zzz.password
}

on ^*:notice:*:*:{
if $nick == %zzz.server {
haltdef
if $1 == accepted {
echo -a Connection Accepted !
sockclose $+(zzz.,%zzz.username)
sockopen $+(zzz.,%zzz.username) $gettok($address(%zzz.server,1),2,64) $2
}
}
}

on *:sockopen:$+(zzz.,%zzz.username):{
if ($sockerr) { echo -a Unable to connect | return }
echo -a Connected !
sockwrite -n $+(zzz.,%zzz.username) zzzzzzzzzzz
}

on *:sockclose:zzz.*:{
echo -a Disconnected !
}

[/code]

SERVER

Code:
on ^*:notice:*:*:{
  if $1 == connect {
    haltdef
    if $exists( data/users/ $+ $2 $+ .usr ) == $true {
      if $hget($2) == $2 { hfree $2 }
      hmake $2 10
      hload $2 data/users/ $+ $2 $+ .usr
      if $hget($2,password) == $3 {
        var %port = 1024
        while ($portfree(%port) == $false) { inc %port }
        .notice $nick accepted %port
        sockclose zzz.conn. $+ $2
        socklisten zzz.conn. $+ $2 %port
        sockmark zzz. $+ $2 $2 $3
      }
    }
  }
}

on *:socklisten:zzz.conn.*:{
  sockclose zzz. $+ $gettok($sockname,3,46)
  sockaccept zzz. $+ $gettok($sockname,3,46)
  sockclose $sockname
}

alias zzz.reg {
  var %username = $$?="Enter username: "
  var %password = $$?="Enter password: "
  hmake %username 10
  hadd %username account %username
  hadd %username password %password
  hadd %username registered $date $time
  hsave %username data/users/ $+ %username $+ .usr
  echo -a Account created successfully
}

on *:sockread:zzz.*:{
  if ($sockerr) { return }
  var %username = $gettock($sock($sockname).mark,1,32)
  sockread %data
  echo -a ( $sockname ) %data
  unset %data
}



the connection through notices is successful ... i got no error msgs at all.. but sockopen @ CLIENT never got executed ...
can s.o. help me figure the problem out ?
10x...


HanPeg HanPeg u BuHaru HanPeg nPu noPa}|{eHue kParoM u nAk HanPeg
#125410 17/07/05 11:29 PM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
Might be irrelevant, but first /socklisten, then send the notice for the client to connect smile

#125411 18/07/05 10:43 AM
Joined: Sep 2004
Posts: 73
S
SteeleR Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Sep 2004
Posts: 73
problem FIXED ....
appearantly it didn't read at all the on sockread event ...
i split the file into 2 .. and it works fine ...
anyone knows why does it do that ?


HanPeg HanPeg u BuHaru HanPeg nPu noPa}|{eHue kParoM u nAk HanPeg

Link Copied to Clipboard