Jump to content

_INetGetIP


w0uter
 Share

Recommended Posts

send a pm to JdeB some time ago but he ignored me B)

so i posted it here, it went something like this:

i was looking through the includes an saw _GetIp

1. it is alot of code

2. half of it is useless since it cannot parse the ip out of the 2nd part.

3. evrything is _INet prefixed and _GetIp isnt.

(its scriptbreaking so it doesnt have to be prefixed, but it would be nice)

so i made this and i was wondering if you would want to include it standardly.

Func _INetGetIp()
    Local $v_ip = _InetGetSource ("http://checkip.dyndns.org/?rnd1=" & Random(1, 65536) & "&rnd2=" & Random(1, 65536))
    $v_ip = StringRegExp($v_ip, '((?:\d{1,3}\p){3}\d{1,3})', 1)
    If @extended Then Return $v_ip[0]
    SetError(1)
    Return -1
EndFunc ;==>_INetGetIp

its a bit faster then _GetIp

#include <Inet.au3>

Func _INetGetIp()
    Local $v_ip = _InetGetSource ("http://checkip.dyndns.org/?rnd1=" & Random(1, 65536) & "&rnd2=" & Random(1, 65536))
    $v_ip = StringRegExp($v_ip, '((?:\d{1,3}\p){3}\d{1,3})', 1)
    If @extended Then Return $v_ip[0]
    SetError(1)
    Return -1
EndFunc ;==>_INetGetIp

ConsoleWrite('my UDF:   ' & _INetGetIp() & @LF & 'standard: ' & _GetIP() & @CRLF)

$t = TimerInit()
For $i = 1 To 10
    _INetGetIp()
Next
$t = TimerDiff($t)
ConsoleWrite($t & @LF)

$t = TimerInit()
For $i = 1 To 10
    _GetIP()
Next
$t = TimerDiff($t)
ConsoleWrite($t & @LF)
Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

  • Developers

send a pm to JdeB some time ago but he ignored me B)

I am NOT ignoring you, but will ignore this remark... :o

so i posted it here, it went something like this:

i was looking through the includes an saw _GetIp

1. it is alot of code

2. half of it is useless since it cannot parse the ip out of the 2nd part.

3. evrything is _INet prefixed and _GetIp isnt.

(its scriptbreaking so it doesnt have to be prefixed, but it would be nice)

I think that proposals to update UDFs should be posted in the Scripts and Scraps forum.

It is also up to the original UDF creator to update his/her UDF and submit that.

Comments on your remarks:

1. there seems to be a false idea that SHORT is good. The current code is not lengthy and made in a way that it has redundancy.

2. If there is a issue with a part of the code then its aways appreciated when a Bug report is filed.

3. We have chosen the UDF name and I am gonna stick with it now... see no real needs to rename it an possible brake scripts.

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I think that proposals to update UDFs should be posted in the Scripts and Scraps forum.

could someone move this then ? thanks B)

It is also up to the original UDF creator to update his/her UDF and submit that.

not to be an ass or something but mine is better, why would i have to contact them ?

1. there seems to be a false idea that SHORT is good. The current code is not lengthy and made in a way that it has redundancy.

2. If there is a issue with a part of the code then its aways appreciated when a Bug report is filed.

3. We have chosen the UDF name and I am gonna stick with it now... see no real needs to rename it an possible brake scripts.

1. why isnt short good ? short is less (k)b's. :o

2. insead of fixing just 1 bug im trying to improve the entire function.

3. yeah thought so :graduated:

Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

  • Developers

could someone move this then ?

Done.

not to be an ass or something but mine is better, why would i have to contact them ?

My point is that I prefer that UDF improvements are posted in this forum or to the creator of the UDF. Saves me from having to do the validation myself... The forum members are doing a lot better job there!! B)

1. why isnt short good ? short is less (k)b's. :o

Didn't say UDFs have to be Lengthy and that Short is wrong, but have seen several ppl claiming to have improved an UDF by making its shorter and stripping all error checking and readability. The focus for an UDF should be on Readability and Proper error checking not just minimal code.

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...