trying to learn sockets - 25/01/06 03:01 AM
Hi,
I've decided to try to learn how to use sockets and I have a few ideas for scripts once I learn. I've looked in the help for mIRC and searched these boards to find basic examples of how to use sockets, but I can't get this to work. Basically, for now, I'm just trying to open a socket to www.yahoo.com and see if I can get it to read data to a variable and then write it to a text file so I can see what the info looks like that you get from sockets. I have an alias and two remotes sections to try to do this. Excuse all the "echoes" in the script. I was just testing to see if things were working.
I've decided to try to learn how to use sockets and I have a few ideas for scripts once I learn. I've looked in the help for mIRC and searched these boards to find basic examples of how to use sockets, but I can't get this to work. Basically, for now, I'm just trying to open a socket to www.yahoo.com and see if I can get it to read data to a variable and then write it to a text file so I can see what the info looks like that you get from sockets. I have an alias and two remotes sections to try to do this. Excuse all the "echoes" in the script. I was just testing to see if things were working.
Code:
alias sockettest { sockopen yahoo www.yahoo.com 80 sockread %temp echo -a %temp } on 1:sockopen:yahoo:{ echo -a socket opened sockread %temp } on 1:sockread:yahoo:{ echo -a hello if ($sockerr > 0) return :nextread sockread %temp if ($sockbr == 0) return if (%temp == $null) %temp = - echo -a %temp write yahoo.txt %temp goto nextread else sockclose yahoo }