mIRC Home    About    Download    Register    News    Help

Print Thread
#28745 08/06/03 10:09 PM
Joined: Mar 2003
Posts: 63
N
NiCk2 Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Mar 2003
Posts: 63
Hi ! I'd like to start understanding sockets. I was wondering if you had a little script easy to understand in order to help me.
I would like to be able to connect a kind of clone to my server in order to detect spam ! Having to open a new server window takes up to much space and one gets mixed up between the remotes.
Thank you in advance for any help you may give me smile

#28746 09/06/03 02:21 AM
Joined: Feb 2003
Posts: 143
N
Vogon poet
Offline
Vogon poet
N
Joined: Feb 2003
Posts: 143
/help sockets

Also if you dont already know this... mIRC translates all the RAW messages that an IRC Server feeds to you so you cant use things like on text and such. When dealing with sockets or a socket bot you would have to get an understanding of what RAW messages a irc server sends you and what they do. You will also need to understand how to connect to a IRC server and staying connected. Like the replying to a ping. To get a better understanding of how an IRC Server works I suggest you go here RFC 1459 to learn about the IRC Protocol.


We don't just write the scripts, we put them to the test! (ScriptBusters)
#28747 09/06/03 02:28 AM
Joined: Jun 2003
Posts: 7
S
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
S
Joined: Jun 2003
Posts: 7
Hey naki.. do you have any help for a scripter who's looking to use sockets to get info from a website (eg. cnn, weather, etc) or something? I'm not a newbie, but I am to the idea of sockets grin

#28748 09/06/03 08:32 AM
Joined: Dec 2002
Posts: 169
J
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 169
Seigre: http://helpdesk.zaz.net/documents/socks.php
or you can do a search of the forums. Search all forums, search for "$sockname GET", and select ALL for a date range.

#28749 09/06/03 10:42 AM
Joined: Mar 2003
Posts: 63
N
NiCk2 Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Mar 2003
Posts: 63
I have been looking through the links you have given to me and I have encountered some little problems lol.
After having opened a socket to a server, I wanted to know what are the differents infos to send in order to get connected.
I have tried /sockwrite -n NameOfSocket PASS something then /sockwrite -n NameOfSocket NICK something and /sockwrite -n NameOfSocket USER something...
In my remote I have the exemple in mIRC help :

Code:
 
on *:sockread:*:{
  if ($sockerr > 0) return
  :nextread
  sockread %temp
  if ($sockbr == 0) return
  if (%temp == $null) %temp = -
  echo 4 -ta %temp
  goto nextread
}
 

Then I get ping timeout, another problem lol !
If someone would be kind enough to give me the right commands in order to be able to get connected, I would realy appreciate it, thanks in advance wink

#28750 09/06/03 11:12 AM
Joined: Dec 2002
Posts: 169
J
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 169
In order to connect to most servers you must send (password is only required if you need one):

PASS password
NICK YourNick
USER username hostname servername :realname
- hostname and servername aren't really important. You can just use * for those.

That should get you connected. If you want to see what mIRC does when it connects do the following.
Open up a new server window by typing /server -n
In that new status window type /debug -pt @debug
Connect to a server.

I highly suggest you read RFC 1459

#28751 09/06/03 06:02 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Well, ever since I saw the post I figured I would try my hand at a secondary connection with sockets. So far, so good. I have the connection open, and have assigned all the major events to signals. This way you can have the nice mirc functionality with a socket connections. i.e.

:KingTomato!MyName@my.mask.com PRIVMSG #king-tomato :Hey everyone

That would trigger a ktclone_text signal. From there, I set %name, %taget (not chan because it could be a query also), and the address of the user. As you can see, the nick that is really sent from the server includes address 5. I made it so that the variable %address contains that whole string, and %nick is up to the ! in the address. In this case, you'd have:

%nick = KingTomato
%address = KingTomato!MyName@my.mask.com

Then from there, use $mask(%adress, <number>) to get your address.

Again, all the main functions like PRIVMSG, INVITE, JOIN, KICK, MODE, PART, QUIT, etc are all atached to events. I'm not quite done yet, as I am making a nice dialog to go with it, but here is the sneak preview:



I'll let you know when it's done laugh


-KingTomato

Link Copied to Clipboard