Aa, I learned once again more. Now I got it work. I hade problem that the server 1 get get stuck to "starting processor task", but that fix when I closed Atom. I changed server 1 a bit. If I stop server 2, the server two doesn't stop because "isopen(s2conn)", but because it can't write to server and gives then a error and doesn't close the connections. I put try/catch/finally to write. It closes the server, but ports are still open. How can I close server 2 and 1 right way, that ports don't stays open. I put argument to server 2 that if mat[1,1] == -1; break;end; but it isn't loop so you can't really break it.
torstai 15. syyskuuta 2016 14.18.46 UTC+3 Tanmay K. Mohapatra kirjoitti: > > Hi. > > 1. fn is the function provided by the do block (see: > http://docs.julialang.org/en/release-0.4/manual/functions/#do-block-syntax-for-function-arguments > ) > 2. Yes. Thanks for pointing out. > 3. I was experimenting with sending multiple messages over the same > connection. It avoids the issue with building up too many sockets in > closewait/timewait state by not opening too many connections in the first > place. > > One way to shut down such servers is to have a special "shutdown message". > When a server gets it, it should stop looping, release resources and exit. > > - Tanmay > > On Thursday, September 15, 2016 at 4:27:47 PM UTC+5:30, Karli Kund wrote: >> >> Wou, that s some hi skill coding. It takes my a while(don't understand) >> to understand it. I got the basics,but I still have couple of questions: >> >> 1. what is fn? There is function proc = fn(sock). What it doses with >> that proc value? >> 2. senddata function should have s1conn = connect(port) or ? >> 3. Why there is while loop in senddata? >> >> I will try it out today and let you know if it works for me. But for now >> it look good and beautiful ^^ >> >> One main problem is how to shut down the server, if there is no break or >> close command? If I try to stop Julia in Atom, the console says Julia has >> stom, but atom is sitll running the program. Only option is close Atom and >> restart it. Any good solutions for this? >> keskiviikko 14. syyskuuta 2016 13.30.05 UTC+3 Tanmay K. Mohapatra >> kirjoitti: >>> >>> Hi, >>> >>> I did not find any slowness when I ran the code. >>> >>> My environment: >>> Julia Version 0.4.6 >>> Commit 2e358ce (2016-06-19 17:16 UTC) >>> Platform Info: >>> System: Linux (x86_64-unknown-linux-gnu) >>> CPU: Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz >>> WORD_SIZE: 64 >>> BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell) >>> LAPACK: libopenblas64_ >>> LIBM: libopenlibm >>> LLVM: libLLVM-3.3 >>> >>> The only thing I observed when I send messages rapidly is the buildup of >>> TCP sockets (in closewait, timewait states). >>> I'm not sure if that could be causing the slowness you observed. >>> That is usually addressed by tuning system parameters, primarily >>> net.ipv4.ip_local_port_range, net.ipv4.tcp_fin_timeout (ref. >>> http://www.linux-admins.net/2010/09/linux-tcp-tuning.html for more >>> details). >>> >>> I reorganized the code somewhat (here: >>> https://gist.github.com/tanmaykm/c2ab61a52cc5afa0e54fe61905a48ef1) to >>> make it easier to understand/reuse. >>> With this it seems possible to merge server1 and server2 into one server >>> and not have an additional hop between the two. >>> You may need them separate though, if you have many server1 and server2 >>> instances. >>> >>> Hope this helps. >>> >>> - Tanmay >>> >>> On Tuesday, September 13, 2016 at 6:20:55 PM UTC+5:30, Karli Kund wrote: >>>> >>>> Hi, >>>> >>>> I posted question in stackoverflow with no answers: >>>> http://stackoverflow.com/questions/39448808/julia-tcp-server-and-connection >>>> >>>> Maybe from here. >>>> >>>
