mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
When using sockudp -k to keep the connection opened (for a client), at some point the local port used (chosen randomly by mirc) sometimes change, which is a bug imo.
It doesn't happen very often and I never reproduced it myself locally, but I could reproduce it almost every time with different people using:
Code:
;server
on *:udpread:socktest:{
sockread -n &a
tokenize 32 $bvar(&a,1-96).text
echo -s $+($sock(socktest).saddr,:,$sock(socktest).sport) - $1- 
}
Type
Code:
/sockudp -k socktest N 127.0.0.1 N

to start listening for packet where N is any valid port (same number for the two here)
Then, start sending some data (not specifying the local port used):
Code:
/timer -ho 3000 0 sockudp -kn socktest1 IP N This is a test

(N is the one used above)
Once the timer is done, wait like 15 seconds and runs it again (might need to do that more than twice) and if the bug occurs, $sock(socktest).sport will be different when running the timer again.

Tested under mIRC 7.19 on win7

Last edited by Wims; 01/09/11 07:48 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Today I faced this bug again, however, since I thought this bug was caused by the /sockudp command, I started using my own method to choose the source port so the problem isn't the /sockudp command, it's the on udpread event, $sock().sport is returning a wrong source port sometimes.
I still cannot reproduce the problem myself locally but I'm now sure the problem exists and seems related to the event rather than the command

edit: mIRC 7.22, win7.

Last edited by Wims; 22/11/11 12:58 AM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Didn't we previously/recently address the $sock().sport issue? Or is this yet another regression?


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
I thought I should post there since the problem doesn't seem to be with /sockudp but with $sock().sport, I'm still not really sure about where the problem occurs, reproducing it is kind of hard/random


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard