I'd like to see blocking sockets in the next version of mIRC. Then we can finally /return data retrieved from a webserver.
They could be implemented in a similar way to the php sockets or mIRC file handling commands:
alias test {
sopen 100 google google.com 80
; 100 is a timeout parameter in seconds.
; mIRC waits until the socket has opened, there's an error or it reaches the timeout parameter.
if ($sopen(google)) {
swrite -n google GET / HTTP/1.1
; mIRC waits until the data has been sent.
swrite -n google Host: www.google.com
; mIRC waits until the data has been sent.
swrite -n google Accept: */*
; mIRC waits until the data has been sent.
swrite -n google
; mIRC waits until the data has been sent.
while (!$sopen(google).feof) echo -s $sread(google)
; Read and echo all data to the status window.
}
elseif ($sopen(google).timeout) {
echo -s google socket timed out.
sclose google
}
else echo -s There was an error: $wserr $wsmsg
}