mIRC Home    About    Download    Register    News    Help

Topic Options
#233661 - 01/09/11 08:47 PM /sockudp -k and random local port
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3465
Loc: France
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


Edited by Wims (01/09/11 08:48 PM)
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#235076 - 21/11/11 09:59 PM Re: /sockudp -k and random local port [Re: Wims]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3465
Loc: France
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.


Edited by Wims (22/11/11 12:58 AM)
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#235087 - 22/11/11 11:34 AM Re: /sockudp -k and random local port [Re: Wims]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
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"

Top
#235088 - 22/11/11 01:35 PM Re: /sockudp -k and random local port [Re: argv0]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3465
Loc: France
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
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top