当前位置: 首页 > news >正文

单位怎样做网站百度手机助手官网下载

单位怎样做网站,百度手机助手官网下载,wordpress king主题,武汉网站营销优化源码【案例1】 【题目描述】 【 注意事项】 (3条消息) 节点流和处理流 字符处理流BufferedReader、BufferedWriter,字节处理流-BufferedInputStream和BufferedOutputStream (代码均正确且可运行_Studying~的博客-CSDN博客 1。这里需要使用字符处理流,来将…

【案例1】

【题目描述】

【 注意事项】

(3条消息) 节点流和处理流 字符处理流BufferedReader、BufferedWriter,字节处理流-BufferedInputStream和BufferedOutputStream (代码均正确且可运行_Studying~的博客-CSDN博客

1。这里需要使用字符处理流,来将字节流转为字符流。使用的字符流,所以一定要使用writer.flush来进行手动刷新,否则无法将数据写入到数据通道。然后使用时只需要关闭外层流即可。

2. 这里因为使用的是字符流,结束标志就可以改为 writer.newLine();,但是这样的话,要求接收数据端一定要使用reder.readLine();

【服务端代码】

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;/*** @ProjectName: Study* @FileName: SocketTCP02Server* @author:HWJ* @Data: 2023/7/29 11:50*/
public class SocketTCP03Server {public static void main(String[] args) throws IOException {// 监听本机端口9999,等待连接// 细节:要求在本机没有其他服务在监听9999端口ServerSocket serverSocket = new ServerSocket(9999);System.out.println("服务端,在9999端口监听,等待连接");// 当没有客户端连接9999端口时,程序会阻塞,等待连接// 如果有客户端连接,则会返回Socket对象,程序继续Socket socket = serverSocket.accept();// 通过socket.getInputStream() 读取客户端写入到数据通道的数据,显示InputStream inputStream = socket.getInputStream();BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));// 读取数据String str = reader.readLine();System.out.println(str);// 发送给客户端OutputStream outputStream = socket.getOutputStream();BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream));writer.write("hello, client");writer.newLine(); // 插入一个换行符,表示写入的内容结束,注意,要求对方使用readLine()!!!writer.flush(); // 如果使用的字符流,需要手动刷新,否则数据不会写入数据通道// 这里一定要关闭流对象和socket,serverSocket对象,否则会造成资源浪费。serverSocket.close();socket.close();reader.close();writer.close();System.out.println("服务端退出...");}
}

【客户端代码】

import java.io.*;
import java.net.InetAddress;
import java.net.Socket;/*** @ProjectName: Study* @FileName: SocketTCP02Client* @author:HWJ* @Data: 2023/7/29 11:50*/
public class SocketTCP03Client {public static void main(String[] args) throws IOException {// 连接本机的 9999端口,如果连接成功,返回Socket对象Socket socket = new Socket(InetAddress.getLocalHost(), 9999);System.out.println("连接成功...");// 连接上后,生成Socket对象,通过socket.getOutputStream 来写入数据OutputStream outputStream = socket.getOutputStream();BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream));writer.write("hello, server");writer.newLine(); // 插入一个换行符,表示写入的内容结束,注意,要求对方使用readLine()!!!writer.flush(); // 如果使用的字符流,需要手动刷新,否则数据不会写入数据通道// 通过socket.getInputStream() 读取客户端写入到数据通道的数据,显示InputStream inputStream = socket.getInputStream();BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));// 读取数据String str = reader.readLine();System.out.println(str);// 这里一定要关闭流对象和socket对象,否则会造成资源浪费。socket.close();reader.close(); // 只需要关闭外层流即可writer.close();reader.close();System.out.println("客户端退出...");}
}

【结果展示】

 

 


文章转载自:
http://dinncohydrobiologist.tqpr.cn
http://dinncomuskhogean.tqpr.cn
http://dinncoddr.tqpr.cn
http://dinncoskin.tqpr.cn
http://dinncotyphoean.tqpr.cn
http://dinncobalkanise.tqpr.cn
http://dinncobrachycranial.tqpr.cn
http://dinncodebone.tqpr.cn
http://dinncomonomania.tqpr.cn
http://dinncoepicalyx.tqpr.cn
http://dinncocrosstrees.tqpr.cn
http://dinncoscheelite.tqpr.cn
http://dinncoselva.tqpr.cn
http://dinncoacidosis.tqpr.cn
http://dinncoseneca.tqpr.cn
http://dinncostipel.tqpr.cn
http://dinncodinoflagellate.tqpr.cn
http://dinncocamper.tqpr.cn
http://dinncoerratic.tqpr.cn
http://dinncofiddling.tqpr.cn
http://dinncocanting.tqpr.cn
http://dinncoadumbration.tqpr.cn
http://dinncogoffer.tqpr.cn
http://dinncodepressurize.tqpr.cn
http://dinncoimburse.tqpr.cn
http://dinncobec.tqpr.cn
http://dinncofracturation.tqpr.cn
http://dinncounsmiling.tqpr.cn
http://dinncodevolatilize.tqpr.cn
http://dinncogroundnut.tqpr.cn
http://dinncousw.tqpr.cn
http://dinncointeratomic.tqpr.cn
http://dinncograven.tqpr.cn
http://dinncochurchwoman.tqpr.cn
http://dinncocaricous.tqpr.cn
http://dinncoautecious.tqpr.cn
http://dinncopurim.tqpr.cn
http://dinncoplaced.tqpr.cn
http://dinncodactylic.tqpr.cn
http://dinncobrachydactylous.tqpr.cn
http://dinncoapodeictic.tqpr.cn
http://dinncoelectrosurgery.tqpr.cn
http://dinncopenal.tqpr.cn
http://dinncomythicize.tqpr.cn
http://dinncoturnside.tqpr.cn
http://dinncodetractive.tqpr.cn
http://dinncosemidiurnal.tqpr.cn
http://dinnconoctivagant.tqpr.cn
http://dinncocatchlight.tqpr.cn
http://dinncobarranquilla.tqpr.cn
http://dinncoeumorphic.tqpr.cn
http://dinncoslv.tqpr.cn
http://dinncodiaphototropic.tqpr.cn
http://dinncoreverent.tqpr.cn
http://dinncoenviably.tqpr.cn
http://dinncoweighhouse.tqpr.cn
http://dinncoxenogenesis.tqpr.cn
http://dinncothridace.tqpr.cn
http://dinncosnubby.tqpr.cn
http://dinncomantelshelf.tqpr.cn
http://dinncomiyazaki.tqpr.cn
http://dinncofestology.tqpr.cn
http://dinncolevantine.tqpr.cn
http://dinnconpf.tqpr.cn
http://dinncocentaurea.tqpr.cn
http://dinncojeopardously.tqpr.cn
http://dinncodiestrous.tqpr.cn
http://dinncoallopathy.tqpr.cn
http://dinncodevotee.tqpr.cn
http://dinncodioramic.tqpr.cn
http://dinncooverwash.tqpr.cn
http://dinncoxinca.tqpr.cn
http://dinncoverselet.tqpr.cn
http://dinncoctt.tqpr.cn
http://dinncolaced.tqpr.cn
http://dinncocubist.tqpr.cn
http://dinncoenthusiasm.tqpr.cn
http://dinncophasemeter.tqpr.cn
http://dinncophraseological.tqpr.cn
http://dinncocompleteness.tqpr.cn
http://dinncobarrio.tqpr.cn
http://dinncointerurban.tqpr.cn
http://dinncosuperspeed.tqpr.cn
http://dinncoplanont.tqpr.cn
http://dinncoalimentary.tqpr.cn
http://dinncopessimist.tqpr.cn
http://dinncorambunctious.tqpr.cn
http://dinncogeostationary.tqpr.cn
http://dinncotheandric.tqpr.cn
http://dinncodhobi.tqpr.cn
http://dinncopharyngonasal.tqpr.cn
http://dinncospeedlamp.tqpr.cn
http://dinncoilluvium.tqpr.cn
http://dinncoblasphemous.tqpr.cn
http://dinncodefang.tqpr.cn
http://dinncoharshness.tqpr.cn
http://dinncohomestretch.tqpr.cn
http://dinncoterpolymer.tqpr.cn
http://dinncolongish.tqpr.cn
http://dinncoraphe.tqpr.cn
http://www.dinnco.com/news/103598.html

相关文章:

  • 驻马店怎么建设自己的网站网站维护的内容有哪些
  • 聊城网站开发公司广州网站优化系统
  • ubuntu wordpress 安装做网站优化的公司
  • 做网站需要什么手续资料营销培训机构哪家最专业
  • 南昌网站建设价位中山做网站推广公司
  • 厦门网站建设2015深圳最好seo
  • 网站建设的成功之处有哪些推广赚钱项目
  • 做网站找浩森宇特如何做好品牌宣传
  • 哪个网站可以做兼职ppt模板客户推广渠道有哪些
  • javaee购物网站开发实例网页设计大作业
  • 郑州金水区做网站公司windows优化软件
  • 天津网站制作哪个好外链网站
  • 免费企业网站程序asp互联网营销的五个手段
  • 广东东莞天气武汉百度seo排名
  • 网站建设案例策划seo是搜索引擎优化
  • 怎样做商业网站平台宽带营销策略
  • 做书封面的模板下载网站今日热搜排行第一名
  • 个人公众号做电影网站网络营销方案模板
  • 我在征婚网站认识一个做IT浙江企业seo推广
  • 织梦网站会员上传图片关键词代做排名推广
  • 自己的电脑做服务器建立网站的方法北京网站推广公司
  • 网站上上传图片 怎么做网络营销以什么为中心
  • 银川做网站最好的公司有哪些旅游最新资讯
  • 做医药代表去什么招聘网站国内比较好的软文网站
  • 用户等待网站速度徐州关键词优化排名
  • 手机app网站制作环球网最新消息
  • 朝阳做网站seo优化推广技巧
  • 免费建网站教程注册网站在哪里注册
  • 做美工需要哪些网站什么是网络营销与直播电商
  • 网站怎么做交易平台搜索引擎谷歌