mIRC Home    About    Download    Register    News    Help

Print Thread
sockmark #136799 03/12/05 09:05 PM
Joined: Dec 2005
Posts: 3
C
Cosminx2003 Offline OP
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Dec 2005
Posts: 3
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

Re: sockmark #136800 06/12/05 10:34 AM
Joined: Apr 2003
Posts: 701
K
Kelder Offline
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
/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.

Re: sockmark [offtopic] #136801 06/12/05 11:16 AM
Joined: Apr 2004
Posts: 840
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 840
Quote:
it can only store 512 bytes of text.

The helpfile indeed states this, but is it actually true?


Saturn, QuakeNet staff
Re: sockmark [offtopic] #136802 06/12/05 11:36 AM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
-- 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.


Gone.
Re: sockmark [offtopic] #136803 06/12/05 11:42 AM
Joined: Apr 2004
Posts: 840
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 840
Good to know, thanks! smile


Saturn, QuakeNet staff