mIRC Home    About    Download    Register    News    Help

Topic Options
#153510 - 18/07/06 12:14 PM socket connections to a BNC
tecsatan Offline
Nutrimatic drinks dispenser

Registered: 24/09/04
Posts: 8
I am trying to set up a socket connection bot (that thats the idea in the long run) my BNC. Going through the BNC seems to remove some of the user error's when dealing with connecting to the server and the socket output's (in theory).

Here is the code:-

alias open.socket {
sockopen conn1 66.90.82.236 50127
echo 4 Socket connection test started
}
on *:SOCKOPEN:conn1: {
if ($sockerr > 0) return
sockwrite -tn $sockname user $rand(a,z) $+ $rand(1,99) $qt(asdf) $qt(asdf) : $+ tecsatan
sockwrite -tn $sockname nick $rand(a,z) $+ $rand(1,9999)
sockwrite -tn $sockname quote PASS <my password>
}
on *:sockread:conn1:{
if ($sockerr > 0) return
:nextread
sockread %temp
if ($sockbr == 0) return
if (%temp == $null) %temp = -
echo 4 %temp
goto nextread
}
alias close.socket {
sockclose conn1
echo 4 Socket connection test finished
}


Here is what I am gettign as a reply:-

Socket connection test started
NOTICE AUTH :You need to say /quote PASS <password>


Now the problem is, how do you send /quote commands over a socket connection? I could be rong but I don't think notice or privmsg will work because your not sending it to a person or room, your sending to the server.


Any ideas?

Top
#153511 - 18/07/06 01:22 PM Re: socket connections to a BNC
SCNDRL Offline
Babel fish

Registered: 19/12/05
Posts: 58
Loc: Izmir, Turkey
delete this from sockopen event sockwrite -tn $sockname quote PASS <my password>
add this to sokcread event " if (/quote pass isin %temp) { sockwrite -tn $sockname quote PASS <my password> } "
_________________________
i like that

Top
#153512 - 18/07/06 01:53 PM Re: socket connections to a BNC
tecsatan Offline
Nutrimatic drinks dispenser

Registered: 24/09/04
Posts: 8
That does not do anything different.

It simple make's sure it waits to be asked before answering. However I don't think sockwrite can just a command QUOTE and have in understood.

I tryed that code in botht he sockwrite and sockread sections. It would make more sens haveing it in the sockread if its an event to be triggered.

So code now reads:-

alias open.socket {
sockopen conn1 66.90.82.236 50127
echo 4 Socket connection test started
}
on *:SOCKOPEN:conn1: {
if ($sockerr > 0) return
sockwrite -tn $sockname user $rand(a,z) $+ $rand(1,99) $qt(asdf) $qt(asdf) : $+ tecsatan
sockwrite -tn $sockname nick $rand(a,z) $+ $rand(1,9999)
}
on *:sockread:conn1:{
if ($sockerr > 0) return
:nextread
sockread %temp
if ($sockbr == 0) return
if (%temp == $null) %temp = -
echo 4 %temp
if (*/quote PASS* isin %temp) { sockwrite -tn $sockname quote PASS <my password>
goto nextread
else
goto nextread
}
}
alias close.socket {
sockclose conn1
echo 4 Socket connection test finished
}



However thats still not doing anything

Top
#153513 - 18/07/06 04:03 PM Re: socket connections to a BNC
SCNDRL Offline
Babel fish

Registered: 19/12/05
Posts: 58
Loc: Izmir, Turkey
My Post
if (/quote pass isin %temp) { sockwrite -tn $sockname quote PASS <my password> }

your code

if (*/quote pass* isin %temp) { sockwrite -tn $sockname quote PASS <my password>

they are same ?
_________________________
i like that

Top
#153514 - 18/07/06 04:14 PM Re: socket connections to a BNC
SCNDRL Offline
Babel fish

Registered: 19/12/05
Posts: 58
Loc: Izmir, Turkey
Umz. I Found The Real ProbLem

Code:
alias open.socket {
  sockopen conn1 66.90.82.236 50127
  echo 4 Socket connection test started
}
on *:SOCKOPEN:conn1: {
  if ($sockerr &gt; 0) return
  sockwrite -tn $sockname user $rand(a,z) $+ $rand(1,99) $qt(asdf) $qt(asdf) : $+ tecsatan
  sockwrite -tn $sockname nick $rand(a,z) $+ $rand(1,9999)
}
on *:sockread:conn1:{
  sockread %temp
  if ($sockerr) { return }
  echo 4 %temp
  if (/quote PASS isin %temp) { sockwrite -n $sockname PASS &lt;pass&gt; }
}
alias close.socket {
  sockclose conn1
  echo 4 Socket connection test finished
}

Dont Use quote
_________________________
i like that

Top
#153515 - 18/07/06 04:55 PM Re: socket connections to a BNC
tecsatan Offline
Nutrimatic drinks dispenser

Registered: 24/09/04
Posts: 8
That does not seem to work ever.

I don't know why but the BNC server does not seem to see the write commands. Or if it does, it makes no reply that it has.

But everything looks as if it should work.

If you have a BNC yourself then please try it and have a go. I would like to hear from anyone that cna get it to connect.

Current code:-

alias open.socket {
sockopen conn1 <your BNC server> <your BNC port>
echo 4 Socket connection test started
}
on *:SOCKOPEN:conn1: {
if ($sockerr > 0) return
sockwrite -tn $sockname user $rand(a,z) $+ $rand(1,99) $qt(asdf) $qt(asdf) : $+ tecsatan
sockwrite -tn $sockname nick $rand(a,z) $+ $rand(1,9999)
}
on *:sockread:conn1:{
sockread %temp
if ($sockerr) { return }
echo 4 %temp
if (/quote PASS isin %temp) {
sockwrite -n $sockname PASS <your pass>
sockwrite -tn $sockname conn <server u want to connect to> <port you want toc onnect on>
sockwrite -tn $sockname join <room you wish to join>
}
}
alias close.socket {
sockclose conn1
echo 4 Socket connection test finished
}

Top
#153516 - 18/07/06 05:36 PM Re: socket connections to a BNC
SCNDRL Offline
Babel fish

Registered: 19/12/05
Posts: 58
Loc: Izmir, Turkey
The Code which is i gave works. but i havent got a BNC so i cant try. but you can try with /server command before /debug @try then /server bncserver port you can see datas which are you send.. you can send this datas with sockwrite command..
_________________________
i like that

Top