基于UTP、TCP的公交车查询系统

该系统包括客户端A、服务程序B和公交车模拟程序C,A使用TCP协议与B交互,B通过UDP与C通信。系统支持连续查询,并在测试中发现了待修复的界面布局和小bug。
摘要由CSDN通过智能技术生成

该系统由A、B、C三部分组成,
其中A为公交车查询客户端程序;
B为公交查询服务程序,负责响应来自A的查询并接收由公交车模拟程序发送过来的当前到站信息;
C为公交车模拟程序,能够模拟多辆公交车发送当前到站信息。
A、B之间采用TCP协议,B、C之间采用UDP协议
该程序可以进行连续查询,只保存了两条公交路线用于测试
程序运行截图:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
代码:
A:

package A;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.util.Arrays;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;

public class Main extends Application{
	BorderPane root;
	Socket socket;
	DataInputStream dis;
	DataOutputStream dos;
	TextField text;
	Button btn;
	@Override
	public void start(Stage stage) throws Exception {
		socketInit();
		root = new Borde
  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值