Permalink
Browse files

fixed small bug in scala example

  • Loading branch information...
1 parent 0a66e99 commit 573b46fdc57ffa247fb4d73b74fd9e9dc3a5a1fa @mbknor committed May 22, 2011
Showing with 14 additions and 8 deletions.
  1. +14 −8 examples/ddsl-scala-examples/src/main/scala/ddslexamples/DdslServiceProvider.scala
@@ -54,16 +54,22 @@ object DdslServiceProvider{
val out = new BufferedWriter( new OutputStreamWriter(s.getOutputStream ) )
val in = new BufferedReader( new InputStreamReader( s.getInputStream))
- while( true ){
+ var continue = true
+ while( continue ){
//wait for command from client
val command = in.readLine
- println("Received: " + command)
-
- //send greeting
- val msg = "Hello from server at port " + port + " ("+System.currentTimeMillis+")"
- println("Sending: " + msg)
- out.write(msg + "\n");
- out.flush
+ if (command == null) {
+ s.close();
+ continue = false
+ } else {
+ println("Received: " + command)
+
+ //send greeting
+ val msg = "Hello from server at port " + port + " ("+System.currentTimeMillis+")"
+ println("Sending: " + msg)
+ out.write(msg + "\n");
+ out.flush
+ }
}
}catch{
case _ => println("Lost connection")

0 comments on commit 573b46f

Please sign in to comment.