一个Scocket实例程序
2008-01-05 19:07:33 来源:WEB开发网核心提示: import java.io.*;import java.net.*;public class EchoServer1{ public static void main(String[] args ){ try{ServerSocket s = new ServerSocket(8500);Socket incom
import java.io.*;
import java.net.*;
public class EchoServer1
{ public static void main(String[] args )
{ try
{
ServerSocket s = new ServerSocket(8500);
Socket incoming = s.accept( );
BufferedReader in = new BufferedReader
(new InputStreamReader(incoming.getInputStream()));
PRintWriter out = new PrintWriter
(incoming.getOutputStream(), true /* autoFlush */);
out.println( "Hello! Enter BYE to exit." );
boolean done = false;
while (!done)
更多精彩
赞助商链接