mIRC Homepage
Posted By: Cosminx2003 sockmark - 03/12/05 09:05 PM
Hi i'm new on here , and i don't speak english very well .. my problem is :
i want to read a line directly from a site .. i know the part with sockopen , etc.. sockread , but after sockread.. i want to scan for a word directly from site , and after it i want to read the $readn line DIRECTLY from site with sockmark.. i think.. :P.. i hope that you did understand me ;-) and please answer me
Posted By: Kelder Re: sockmark - 06/12/05 10:34 AM
/sockmark is used to keep a short note attached to a socket connection, it can only store 512 bytes of text. This text is never sent to the destination of the socket, it's just a post-it on a socket.

$readn is only used after a $read statement, and $read can only read from filed on your computer. It has nothing to do with sockets.

Since you say you understand /sockopen and /sockread: to scan for a line of text, just /sockread %text and then compate that %text to what you scan for, if it's in there you have found it, otherwise /sockread again.

If you want to keep the line numbers: do /inc %socketcounter after each /sockread. (For a website you want to only start doing this after all headers are sent) Once you find the text you were looking for, the value of %socketcounter is the line number you want. Also, put /unset %socketcounter in the script that opens the socket.
Posted By: Sat Re: sockmark [offtopic] - 06/12/05 11:16 AM
Quote:
it can only store 512 bytes of text.

The helpfile indeed states this, but is it actually true?
Posted By: FiberOPtics Re: sockmark [offtopic] - 06/12/05 11:36 AM
-- Generaly reply --

Indeed, it's not true.

The length of the data that you can store in the .mark property, is a maximum of 939 characters, if your sockname is only 1 character long. The longer the sockname, the less bytes you can store, similarly with the general string too long limit, and variables. The longer the variable name, the less bytes you can store in it.

Example:

sockmark m $str(.,939)
sockmark mm $str(.,938)
sockmark mmm $str(.,937)
...

The reason that it states the 512 bytes limit in the help file, is because Khaled/Tjerk forgot to update it in the help file, since it states the following in the versions.txt:

Quote:

08/01/99 - mIRC v5.5

142./sockmark now allows storage up to the max. length of chars that mIRC
usually handles for other lines.
Posted By: Sat Re: sockmark [offtopic] - 06/12/05 11:42 AM
Good to know, thanks! smile
© mIRC Discussion Forums