Hi,

i have java server and flash client. what i need is,

whenever i send data from flash server should printstream that data
back to the client. So that i can display it in flash. Any help would
be appreciated.

import java.io.IOException;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.io.*;

public class MultiThreadServer implements Runnable {
Socket csocket;

MultiThreadServer(Socket csocket) {
this.csocket = csocket;
}

public static void main(String args[]) throws Exception {
ServerSocket ssock = new ServerSocket(1234);
System.out.println("Listening");
while (true) {
Socket sock = ssock.accept();
System.out.println("Connected");
BufferedReader br = new BufferedReader(new
InputStreamReader(sock.getInputStream()));
PrintStream ps = new PrintStream(
sock.getOutputStream());
ps.println(br.readLine());

if(br.readLine()==("data"))
new Thread(new MultiThreadServer(sock)).start();
}
}

public void run() {
try {
System.out.println("hello");
PrintStream pstream = new PrintStream(csocket.getOutputStream());
while(true) {
try{
pstream.println("dead&dead1" + "\u0000");
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}

}

//for (int i = 100; i >= 0; i--) {
// pstream.println(i + " bottles of beer on the wall");
//}
//pstream.close();
//csocket.close();
} catch (IOException e) {
System.out.println(e);
}
}
}





Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en

Reply via email to