import java.net.*; import java.io.*; import java.awt.*; import java.awt.event.*; import java.beans.IndexedPropertyChangeEvent; public class Myserver implements Runnable { ServerSocket server = null; Socket clientSocket; boolean flag = true; Thread connenThread; BufferedReader sin; DataOutputStream sout; public static void main(String[] args) { Myserver MS = new Myserver(); MS.severStart(); } public void severStart() { try { server = new ServerSocket(8080); System.out.println("傷諳瘍"+server.getLocalPort()); while(flag) { clientSocket = server.accept(); System.out.println("蟀諉眒冪膘蕾俇救"); InputStream is = clientSocket.getInputStream(); sin = new BufferedReader(new InputStreamReader(is)); OutputStream os = clientSocket.getOutputStream(); sout = new DataOutputStream(os); connenThread = new Thread(this); connenThread.start(); String aLine; while ((aLine = sin.readLine()) != null) { System.out.println(aLine); if(aLine.equals("bye")) { flag = false; connenThread.interrupt(); break; } } sout.close(); os.close(); sin.close(); is.close(); clientSocket.close(); System.exit(0); } } catch (Exception e) { System.out.println(e); } } public void run() { while(true) { try { int ch; while ((ch=System.in.read())!=-1) { sout.write((byte)ch); if(ch=='\n') { sout.flush(); } } } catch(Exception e) { System.out.println(e); } } } public void finalize() { try { server.close(); } catch(IOException e) { System.out.println(e); } } }

as501226107 LV12
2022年12月28日
丶知北游丿 LV9
2022年6月15日
bearloadprogress LV7
2022年5月12日
tangjj7260 LV18
2021年12月10日
Super Gino LV1
2021年11月8日
爱情戴罪的羔羊 LV7
2021年7月12日
飞翔的面包片 LV13
2021年7月12日
2673747024 LV7
2021年1月9日
liangge2115 LV27
2021年1月1日
yangctz LV25
2020年11月25日

22344341 LV2
2024年12月24日
xiaokang1 LV10
2024年3月29日
youwuzuichen LV11
2023年12月15日
2290995171
2023年3月14日
暂无贡献等级
好好学代码
2023年2月16日
暂无贡献等级
aixiao5213 LV1
2022年12月28日
zhiwei0127 LV1
2022年11月6日
linboss LV4
2022年8月18日
ewan007 LV30
2022年6月27日
106sadadwd LV2
2022年6月18日