=================서버=====================
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;
class A implements Runnable {
ServerSocket ss;
Socket s;
OutputStream os;
InputStream is;
Scanner sc;
String str;
void init() {
try {
ss = new ServerSocket(7777);
s = ss.accept();
os = s.getOutputStream();
is = s.getInputStream();
} catch (Exception ee) {
}
}
public void run() {
read();
}
public void read() {
while (true) {
sc = new Scanner(is);
str = sc.nextLine();
System.out.println(str);
}
}
public void send() {
sc = new Scanner(System.in);
try {
str = sc.nextLine() + "\n";
os.write(str.getBytes());
} catch (Exception e) {
}
}
}
public class geeserver {
public static void main(String[] args) {
A a = new A();
Thread th = new Thread(a);
a.init();
th.start();
a.send();
}
}
JSP include 간단 개념 (0) | 2015.02.06 |
---|---|
JSP application , session과 화면이동 3가지 방법 (0) | 2015.02.06 |
JSP 한글 파라미터 깨질때 (0) | 2015.02.02 |
JSP method = "post" (0) | 2015.02.02 |
JSP 공부 request.get... (0) | 2015.02.02 |