1. fn is the function provided by the do block 
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 

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
>>   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. 

Reply via email to