⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serverservice.java~21~

📁 是用java实现的客户机与服务器之间通信的问题的解决。里面包括客户机和服务器两端的程序。
💻 JAVA~21~
字号:
package mysocketserver;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.net.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2003</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class ServerService extends JFrame {  JPanel contentPane;  BorderLayout borderLayout1 = new BorderLayout();  JTextArea jTextArea1 = new JTextArea();  ServerSocket serverSocket;  //Construct the frame  public ServerService() {    enableEvents(AWTEvent.WINDOW_EVENT_MASK);    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  public ServerService(int Port,int Count) {      enableEvents(AWTEvent.WINDOW_EVENT_MASK);      try {        jbInit();        serverSocket = new ServerSocket(Port,Count);        show();        ServiceThread MyST = new ServiceThread();        MyST.show();        while(true)        {         ;        }      }      catch(Exception e) {        e.printStackTrace();      }    }  //Component initialization  private void jbInit() throws Exception  {    contentPane = (JPanel) this.getContentPane();    jTextArea1.setText("监听服务启动");    contentPane.setLayout(borderLayout1);    this.setEnabled(false);    this.setResizable(false);    this.setSize(new Dimension(400, 300));    this.setTitle("Server Listener");    contentPane.add(jTextArea1, BorderLayout.CENTER);  }  //Overridden so we can exit when window is closed  protected void processWindowEvent(WindowEvent e) {    super.processWindowEvent(e);    if (e.getID() == WindowEvent.WINDOW_CLOSING) {      System.exit(0);    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -