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

Reply via email to