Originally Posted By: Riamus2
You do not want to have your echo line in the sockread event. Or, at least, you don't want it until a check that shows you're done reading from the socket. Everything in the sockread event is done/checked for each line in the socketed file. So you are echoing after every line is read.

Code:
on *:sockread:socketname: {
  sockread %data
  set %output %output $chr(124) %data
}

on *:sockclose:socknetname: {
  if (%output) {
    echo -a %output
    unset %output
  }
  else { echo -a No data. }
}


* This is a very basic example and probably needs "fleshed out" a bit depending on the data in the socketed file.

** If you have a LOT of text, you may have to use a binary variable instead.

EDIT: I put in an error check if you have no data from the socket. It can be edited or removed as needed.

Thank you very much, this works! smile

But if I've got this %var = Show Name@House | Show URL

How would I get only House out of this?

I tried this and it works, but I think it's too complicated:

Code:
$gettok($matchtok(%var,Show Name,1,124),2,64)


Is there any simpler method?

Last edited by gaui; 21/04/10 11:54 PM.

__________________________
Curiosity killed the cat.