• 大小: 15KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-01-08
  • 语言: Java
  • 标签: java  tcp  socket  swing  

资源简介

使用java开发,swing界面,TCP客户端和服务端简单通信实验

资源截图

代码片段和文件信息

import java.awt.EventQueue;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

import javax.swing.Jframe;
import javax.swing.JTextArea;
import java.awt.BorderLayout;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JPanel;

public class TCPClient {

private Jframe frmSocketclient;
static PrintWriter os;
static BufferedReader is;
/**
 * Launch the application.
 */
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
try{
Socket socket=new Socket(“127.0.0.1“4567);


 os=new PrintWriter(socket.getOutp

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        432  2017-11-21 17:40  Project1-Socket\.classpath

     文件        391  2017-11-21 17:05  Project1-Socket\.project

     文件        598  2017-11-21 17:05  Project1-Socket\.settings\org.eclipse.jdt.core.prefs

     文件        432  2017-11-21 17:40  Project1-Socket\bin\.classpath

     文件        391  2017-11-21 17:05  Project1-Socket\bin\.project

     文件        598  2017-11-21 17:05  Project1-Socket\bin\.settings\org.eclipse.jdt.core.prefs

     文件        118  2015-03-15 20:44  Project1-Socket\bin\proprammingProject1 humidity.dat

     文件        214  2015-03-15 20:43  Project1-Socket\bin\proprammingProject1 light.dat

     文件         85  2015-03-15 20:43  Project1-Socket\bin\proprammingProject1 temperature.dat

     文件       1676  2017-11-21 17:40  Project1-Socket\bin\TCPClient$1.class

     文件       1400  2017-11-21 17:40  Project1-Socket\bin\TCPClient$2.class

     文件       1406  2017-11-21 17:40  Project1-Socket\bin\TCPClient$3.class

     文件       1405  2017-11-21 17:40  Project1-Socket\bin\TCPClient$4.class

     文件       1980  2017-11-21 17:40  Project1-Socket\bin\TCPClient.class

     文件       2815  2017-11-21 17:48  Project1-Socket\bin\TCPServer$1$1.class

     文件        898  2017-11-21 17:48  Project1-Socket\bin\TCPServer$1.class

     文件       3718  2017-11-21 17:48  Project1-Socket\bin\TCPServer.class

     文件        118  2015-03-15 20:44  Project1-Socket\src\data\proprammingProject1 humidity.dat

     文件        214  2015-03-15 20:43  Project1-Socket\src\data\proprammingProject1 light.dat

     文件         85  2015-03-15 20:43  Project1-Socket\src\data\proprammingProject1 temperature.dat

     文件       3028  2017-11-21 17:38  Project1-Socket\src\TCPClient.java

     文件       5878  2017-11-21 17:48  Project1-Socket\src\TCPServer.java

     目录          0  2017-11-21 17:40  Project1-Socket\bin\.settings

     目录          0  2017-11-21 17:38  Project1-Socket\src\data

     目录          0  2017-11-21 17:05  Project1-Socket\.settings

     目录          0  2017-11-21 17:46  Project1-Socket\bin

     目录          0  2017-11-21 17:39  Project1-Socket\src

     目录          0  2017-11-21 17:39  Project1-Socket

----------- ---------  ---------- -----  ----

                27880                    28

............此处省略1个文件信息

评论

共有 条评论