freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

分布式系統(tǒng)實(shí)驗(yàn)報(bào)告(編輯修改稿)

2024-08-28 18:51 本頁面
 

【文章內(nèi)容簡介】 。throws IOException { byte[ ] sendBuffer = ()。 DatagramPacket datagram =new DatagramPacket(sendBuffer, , receiverHost, receiverPort)。(datagram)。} public String receiveMessage()throws IOException {byte[ ] receiveBuffer = new byte[MAX_LEN]。DatagramPacket datagram = new DatagramPacket(receiveBuffer, MAX_LEN)。(datagram)。String message = new String(receiveBuffer)。return message。} public DatagramMessage receiveMessageAndSender()throws IOException {byte[ ] receiveBuffer = new byte[MAX_LEN]。DatagramPacket datagram = new DatagramPacket(receiveBuffer, MAX_LEN)。(datagram)。DatagramMessage returnVal = new DatagramMessage()。(new String(receiveBuffer), (),())。return returnVal。} } import .*。public class DatagramMessage{private String message。private InetAddress senderAddress。private int senderPort。public void putVal(String message, InetAddress addr, int port) { = message。 = addr。 = port。}public String getMessage() {return 。}public InetAddress getAddress() {return 。}public int getPort() {return 。}} 2. 用流式 socket 實(shí)現(xiàn)的 daytime 應(yīng)用程序包的構(gòu)架,列明各程序之間的關(guān)系;客戶端:服務(wù)端:共有的:import .*。import .*。public class MyStreamSocket extends Socket { private Socket socket。 private BufferedReader input。 private PrintWriter output。 MyStreamSocket(InetAddress acceptorHost, int acceptorPort ) throws SocketException, IOException{ socket = new Socket(acceptorHost, acceptorPort )。 setStreams()。 } MyStreamSocket(Socket socket) throws IOException { = socket。 setStreams()。 } private void setStreams() throws IOException{ InputStream inStream = ()。 input = new BufferedReader(new InputStreamReader(inStream))。 OutputStream outStream = ()。 output = new PrintWriter(new OutputStreamWriter(outStream))。 } public void sendMessage(String message) throws IOException { (message)。 ()。 } public String receiveMessage() throws IOException { String message = ()。 return message。 }} 客戶端:import .*。public class DaytimeClient2 {public static void main(String[] args) {InputStreamReader is = new InputStreamReader()。BufferedReader br = new BufferedReader(is)。try {(Wele to the Daytime client.\n +What is the name of the server host)。String hostName = ()。if (() == 0)hostName = localhost。 (What is the port number of the server host)。String portNum = ()。if (() == 0)portNum = 13。 (Here is the timestamp received from the server+ (hostName, portNum))。} catch (Exception ex) {()。}} } import .*。public class DaytimeClientHelper2 {public static String getTimestamp(String hostName,String portNum) throws Exception { String timestamp = 。 InetAddress serverHost = (hostName)。int serverPort = (portNum)。(Connection request made)。MyStreamSocket mySocket = new MyStreamSocket(serverHost, serverPort)。timestamp = ()。()。return timestamp。} } 服務(wù)端:import .*。import .*。import 。public class DaytimeServer2 {public static void main(String[] args) {int serverPort = 13。 if ( == 1 )serverPort = (args[0])。 try {ServerSocket myConnectionSocket = new ServerSocket(serverPort)。(Daytime server ready.)。 while (true) { (Waiting for a connection.)。MyStreamSocket myDataSocket = new MyStreamSocket(())。(A client has made connection.)。Date timestamp = new Date ()。(timestamp sent: + ())。(())。()。} } catch (Exception ex) {()。} } } 3. 用數(shù)據(jù)包 socket 實(shí)現(xiàn)的 echo 應(yīng)用程序包的構(gòu)架,列明各程序之間的關(guān)系;客戶端:import .*。public class EchoClient1 {static final String endMessage = .。public static void main(String[] args) {InputStreamReader is = new InputStreamReader()。BufferedReader br = new BufferedReader(is)。try {(Wele to the Echo client.\n +What is the name of the server host)。String hostName = ()。if (() == 0) hostName = localhost。(What is the port number of the server host)。String portNum = ()。if (() == 0)portNum = 7777。
點(diǎn)擊復(fù)制文檔內(nèi)容
電大資料相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1