mIRC Homepage
Posted By: Wims /sockudp -k and random local port - 01/09/11 07:47 PM
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
Posted By: Wims Re: /sockudp -k and random local port - 21/11/11 09:59 PM
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.
Posted By: argv0 Re: /sockudp -k and random local port - 22/11/11 11:34 AM
Didn't we previously/recently address the $sock().sport issue? Or is this yet another regression?
Posted By: Wims Re: /sockudp -k and random local port - 22/11/11 01:35 PM
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
© mIRC Discussion Forums