Hello Miyuru. I am unable to reproduce the problem you are having. On my system (RedHat 6.3), your EchoServer works ok both when I set X10_NPLACES and when I don't. Am I doing something differently?
$ vi EchoServer.x10 // paste your program below $ ../bin/x10c EchoServer.x10 // compile with X10 2.3.1 $ ../bin/x10 EchoServer // run without X10_NPLACES $ telnet localhost 1212 // in another window > Trying ::1... > Connected to localhost. > Escape character is '^]'. > hi > hi > there > there // kill EchoServer $ X10_NPLACES=2 ../bin/x10 EchoServer // run with X10_NPLACES=2 $ telnet localhost 1212 // in another window > Trying ::1... > Connected to localhost. > Escape character is '^]'. > hi > hi > there > there // kill EchoServer - Ben From: Miyuru Dayarathna <miyu...@yahoo.co.uk> To: "x10-users@lists.sourceforge.net" <x10-users@lists.sourceforge.net>, Date: 03/21/2013 09:54 AM Subject: [X10-users] An Echo Server in X10 Hello, I am trying to write a very simple Echo server using managed X10. The code I wrote is shown below. The code compiles and runs well with X10 2.3.1 unless I set the variable X10_NPLACES. Once I set the variable X10_NPLACES the application continues running. However, I cannot connect to the server from outside (E.g., via telnetting to port 1212). Could any one please explain me the reason for such behavior and a solution that I can take? I want to run the echo server with multiple places. I tried to code the server in Java and link to X10 via @Native() syntax but faced the same problem. Thank you very much for your support in advance. Thanks, Miyuru. --------------------------------------- import java.net.Socket; import java.net.ServerSocket; import java.net.BindException; import java.io.IOException; import java.io.BufferedReader; import java.io.PrintWriter; import java.io.InputStreamReader; public class EchoServer { public static def main(Array[String]) { try{ var srv:ServerSocket = new ServerSocket(1212); while(true){ var sessionSkt:Socket = srv.accept(); var buff:BufferedReader = new BufferedReader(new InputStreamReader(sessionSkt.getInputStream())); var out:PrintWriter = new PrintWriter (sessionSkt.getOutputStream()); var msg:String = null; while((msg = buff.readLine())!= null){ out.println(msg); out.flush(); } } }catch(var e:BindException){ e.printStackTrace(); } catch (var ec:IOException) { ec.printStackTrace(); } } } --------------------------------------- ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users
<<inline: graycol.gif>>
------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users