运行下面代码,客户端和服务器端都处于僵持等待状态
UTP客户端
package com.xiaozhi.jingtian.tcp;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
public class UploadClient {
public static void main(String[] args) throws Exception, IOException {
//创建客户端的Socket服务,指定目的主机和端口号
Socket socket=new Socket("121.251.158.251",10002);
BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(new FileInputStream("c://1.txt")));
BufferedReader socket_bufferedReader=new BufferedReader(new InputStreamReader(socket.getInputStream()));
BufferedWriter socket_bufferedWriter= new BufferedWriter(new OutputStreamWriter(socket.getOutputStr
版权声明:本文为jingtianxiaozhi01原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。