Hello Ben,

Thank you very much for your response. I followed the same sequence of execution as you mentioned and was able to run the EchoServer even with setting X10_NPLACES. I will use the same method you mentioned to create a shell script that will declare the shell variable X10_NPLACES and run the server which completely solves my problem.

Just to provide you more details about the issue, the behavior that I mentioned early happened on a Linux Cent OS 5.7 (kernel 2.6.18). It only happened when I export the variable (E.g., export X10_NPLACES=2). If I just declare X10_NPLACES as a shell variable this behavior does not occur. Today I ran the same Echo server with/without exporting the X10_NPLACES on a Linux Ubuntu-11.10-desktop-1386 (kernel 3.0.0) and I was able to connect to the EchoServer from outside. I built the X10 2.3.1 from source using the options -DNO_CHECKS=true -Doptimize=true squeakyclean. Anyway, I am completely happy with the current solution and thank you once again.

Thanks,
Miyuru.


From: Benjamin Herta <bhe...@us.ibm.com>
To: Miyuru Dayarathna <miyu...@yahoo.co.uk>
Cc: Mailing list for users of the X10 programming language <x10-users@lists.sourceforge.net>
Sent: Thursday, 21 March 2013, 23:44
Subject: Re: [X10-users] An Echo Server in X10

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


Inactive hide details for Miyuru Dayarathna ---03/21/2013 09:54:08 AM---Hello, I am trying to write a very simple Echo server uMiyuru Dayarathna ---03/21/2013 09:54:08 AM---Hello, I am trying to write a very simple Echo server using managed X10. The code I wrote is shown b

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



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

Reply via email to