mIRC Home    About    Download    Register    News    Help

Page 1 of 2 1 2 >
Topic Options
#220424 - 13/04/10 10:35 PM [7.0 beta] Sockets (sockread event) not working
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
I have 3 scripts that use sockets. They work fine in 6.35, but in the beta, they fail between the sockopen event and the sockread event. I can see an echo at the end of the sockopen event, so it's completing, and $sockerr there shows 0, so there's no socket error there. However, I can't get an echo from the very first line of the sockread event, so it's not triggering that event for some reason.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#220425 - 14/04/10 02:00 AM Re: [7.0 beta] Sockets (sockread event) not working [Re: Riamus2]
drum Offline
Fjord artisan

Registered: 08/12/02
Posts: 339
My socket scripts are working fine.

Top
#220426 - 14/04/10 02:09 AM Re: [7.0 beta] Sockets (sockread event) not working [Re: Riamus2]
Wiz126 Offline
Babel fish

Registered: 22/03/10
Posts: 57
Sockets work fine here. This might be a firewall issue for you, did you check your firewall?

Can you provide an example script?

Top
#220427 - 14/04/10 02:11 AM Re: [7.0 beta] Sockets (sockread event) not working [Re: Wiz126]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
I've been helping people with firewall issues for many years... it's not a firewall issue. The scripts work just fine in 6.35, so it's a change in 7.0 beta and all my scripts are available from www.kakkoiitranslations.net/mircscripts/ . The weather, dictionary, or bible scripts are all socket scripts. Also, I'm not the only one with issues using the scripts in beta.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#220428 - 14/04/10 04:55 AM Re: [7.0 beta] Sockets (sockread event) not working [Re: Wiz126]
HorseC Offline
Fjord artisan

Registered: 03/03/04
Posts: 526
Loc: New York, USA
I am one of the people who reported this issue to Ram...

It is NOT a firewall issue, if it were, it would not work on 6.35 and NOT on 7.0 when both are running (at the same time) from the same machine. There is some issue in this area, and I think we need to let K. look at this to determine what the issue is... I am on XP and other are on windows 7 so it does not seem to be an os related issue either..

Hope this helps to track it down.

_________________________
Help others! It makes the world a better place, Makes you feel good, and makes you Healthy!

Top
#220436 - 14/04/10 03:23 PM Re: [7.0 beta] Sockets (sockread event) not working [Re: Riamus2]
Khaled Offline


Planetary brain

Registered: 04/12/02
Posts: 4449
Loc: London, UK
I have not been able to reproduce this so far. I created a test script that downloads pages from a website and it seems to be working correctly. Can you provide a short sample script that reproduces this issue for you?

Top
#220441 - 14/04/10 08:26 PM Re: [7.0 beta] Sockets (sockread event) not working [Re: Riamus2]
hixxy Offline
Hoopy frood

Registered: 06/09/05
Posts: 2876
I'm not able to reproduce this.

Using mIRC v7.0 I whipped up a small script:

Code:
alias vcheck {
  sockclose vcheck
  sockopen vcheck www.mirc.com 80
}

on *:sockopen:vcheck:{
  if ($sockerr) { 
    echo -a ERROR $sock($sockname).wserr : $sock($sockname).wsmsg
    return
  }
  sockwrite -n $sockname GET /get.html HTTP/1.1
  sockwrite -n $sockname host: www.mirc.com
  sockwrite -n $sockname
}

on *:sockread:vcheck:{
  var %data
  sockread %data
  if (*the latest version is* iswm %data) {
    echo -a $replace(%data,<strong>,$chr(2),</strong>,$chr(2))
    sockclose $sockname
  }
}


This runs fine and correctly echoes the mIRC version from the download page.

Top
#220442 - 14/04/10 08:38 PM Re: [7.0 beta] Sockets (sockread event) not working [Re: hixxy]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
I'll get something as soon as I get home. Have you tried with HTTP/1.0? Perhaps that's the cause... maybe a change in beta makes 1.0 not work? I can't check into anything right now to see. It's possible there's some issue in the scripts, but without being able to get any error message or echo result to show me what's happening, I'm at a standstill and haven't been able to really spend much time with it.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#220443 - 14/04/10 09:53 PM Re: [7.0 beta] Sockets (sockread event) not working [Re: Riamus2]
hixxy Offline
Hoopy frood

Registered: 06/09/05
Posts: 2876
HTTP/1.0 works fine for me too - it may be something to do with your particular script or the website you're connecting to.

Top
#220445 - 15/04/10 12:10 AM Re: [7.0 beta] Sockets (sockread event) not working [Re: hixxy]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
Ok, I found the cause.

I had previously been combining the final $crlf with the last sockwrite line using $+ rather than as a separate line. This worked fine in 6.35, but apparently won't work anymore. With a separate line added for the $crlf (or just a blank -n line), it works fine.

So this isn't a bug and the way I was doing it before was probably just luck that it worked as it probably wasn't intended to work that way. That said, I've seen others use the same methods and if there isn't a reason not to allow it, I think it might be better to maintain that ability rather than forcing any scripts that had used that method to update. Up to you though. I'll change them anyhow just to make them "correct." wink
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#220446 - 15/04/10 05:04 AM Re: [7.0 beta] Sockets (sockread event) not working [Re: Riamus2]
HorseC Offline
Fjord artisan

Registered: 03/03/04
Posts: 526
Loc: New York, USA
Riamus2,

when you get this resolve, (ie new version of the dict and other scripts. let me know online, so i can help the user who reported an issue to me.
Thanks for the great followup on this one smile

Jim

_________________________
Help others! It makes the world a better place, Makes you feel good, and makes you Healthy!

Top
#220452 - 15/04/10 08:06 AM Re: [7.0 beta] Sockets (sockread event) not working [Re: Riamus2]
hixxy Offline
Hoopy frood

Registered: 06/09/05
Posts: 2876
That's odd, as far as I know /sockwrite -n has always worked this way: it will only append a CRLF if the line doesn't already end with one. At least that's what the 6.35 help file says.

You can also send the two CRLFs at the end like so:

Code:
  sockwrite -n $sockname GET /get.html HTTP/1.1
  sockwrite $sockname host: www.mirc.com $str($crlf,2)


This works as you would expect.

Top
#220456 - 15/04/10 11:10 AM Re: [7.0 beta] Sockets (sockread event) not working [Re: hixxy]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
This is how I had it end before:

sockwrite -n $sockname Accept: */* $crlf $+ $crlf

That fails. Yes, it could have been done as $str, but I just didn't bother. I just tried it with $str($crlf,2) and it fails as well. It only works if I drop those and add a sockwrite -n $sockname on the next line (actually, if I leave them it works as long the empty -n is on the next line). This is using 1.0 if that matters.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#220470 - 15/04/10 03:37 PM Re: [7.0 beta] Sockets (sockread event) not working [Re: Riamus2]
Khaled Offline


Planetary brain

Registered: 04/12/02
Posts: 4449
Loc: London, UK
Thanks, I have just reviewed the changes relating to the way CRLFs are handled in custom sockets and a few other features, comparing them with v6.35, and have changed the behavior back to how v6.35 was handling them, so your socket scripts should work again in the next version.

Top
#220471 - 15/04/10 03:46 PM Re: [7.0 beta] Sockets (sockread event) not working [Re: Khaled]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
Sounds good. The changes didn't have to be changed back if they were important or useful or whatever. It's an easy change to make them work again (and perhaps is better that way anyhow). Thanks.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#220472 - 15/04/10 03:52 PM Re: [7.0 beta] Sockets (sockread event) not working [Re: Riamus2]
Khaled Offline


Planetary brain

Registered: 04/12/02
Posts: 4449
Loc: London, UK
It was technically a bug. When /sockwrite -n was used, mIRC v7.0 was stripping out all CRLFs from the end of the line and adding only one CRLF, which it should not have been doing.

Top
#220480 - 15/04/10 05:57 PM Re: [7.0 beta] Sockets (sockread event) not working [Re: Khaled]
hixxy Offline
Hoopy frood

Registered: 06/09/05
Posts: 2876
The help file should probably be updated then, as this section isn't how /sockwrite behaves:

Quote:
The -n switch appends a $crlf to the line being sent if it's not a &binvar and if it doesn't already have a $crlf.

Top
#220482 - 15/04/10 06:24 PM Re: [7.0 beta] Sockets (sockread event) not working [Re: hixxy]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3515
Loc: France
This description is fine, it's what sockwrite -n do.
What is wrong for you ?
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#220483 - 15/04/10 06:30 PM Re: [7.0 beta] Sockets (sockread event) not working [Re: Wims]
hixxy Offline
Hoopy frood

Registered: 06/09/05
Posts: 2876
Code:
alias vcheck {
  sockclose vcheck
  sockopen vcheck www.mirc.com 80
}

on *:sockopen:vcheck:{
  if ($sockerr) { 
    echo -a ERROR $sock($sockname).wserr : $sock($sockname).wsmsg
    return
  }
  sockwrite -n $sockname GET /get.html HTTP/1.1
  sockwrite -n $sockname host: www.mirc.com $str($crlf,2)
}

on *:sockread:vcheck:{
  var %data
  sockread %data
  if (*the latest version is* iswm %data) {
    echo -a $replace(%data,<strong>,$chr(2),</strong>,$chr(2))
    sockclose $sockname
  }
}


In mIRC 6.35 (and presumably the next beta), the above code works. However, that contradicts the description of /sockwrite -n. In the above script, in 6.35, the /sockwrite command is adding a CRLF to the end of the line even though there's already two CRLFs at the end.

/sockwrite -n in the help file says:

Quote:
The -n switch appends a $crlf to the line being sent if it is not a &binvar and if it does not already have a $crlf.


In other words, if it does have a CRLF then mIRC shouldn't be adding one.

Top
#220484 - 15/04/10 06:34 PM Re: [7.0 beta] Sockets (sockread event) not working [Re: hixxy]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
Are you sure it's adding a third $crlf? Maybe it's seeing 2 and so isn't doing anything as the help file seems to indicate? That would make sense since it still needs 2 $crlf's at the end, but you should only need 1 if -n is adding a $crlf.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
Page 1 of 2 1 2 >