On Tuesday, August 30, 2016 at 5:26:29 AM UTC, Jacob Yates wrote:
>
> I've been working on porting a script I wrote in python to julia and have 
> been having some issues with the script freezing.
>
> So pretty much all this script does is generate a random IP address and 
> checks to see if its valid(the Python version will give http error codes) 
> then logs the results for further analysis.
>
> function gen_ip()
>         ip = Any[]
>         for i in rand(1:255, 4)
>                 push!(ip, i)
>         end
>         global ipaddr = join(ip, ".")
> end
>
 
[..]

        println("Bactrace: ", backtrace())
>

Note, there is a type for IP addresses, done like: ip"127.0.0.1" (should 
also work for IPv6) or:

gen_ip() = IPv4(rand(0:256^4-1)) #not sure why you excluded 0 in 1:255 
(might want to exclude some IPs but not as much as you did?), or used 
global.

http://docs.julialang.org/en/release-0.4/manual/networking-and-streams/

Generally global is bad form, and I'm not sure, but it might have something 
to do with @async not working, as I guess it's not "thread-safe" or 
related..

-- 
Palli.

 
 

Reply via email to