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

正文內(nèi)容

java課程設(shè)計聊天小程序(編輯修改稿)

2025-02-12 05:07 本頁面
 

【文章內(nèi)容簡介】 為特殊值,專指全體聊天 } if((610665c2a05631a7bc460993bae36ee6)==false){//若為密語 int i=0。 for(。i()。i++) //查找目的客戶線程在clientVector中的位置 if((i).(name)==true) break。 if(i=()){ //若找不到目的客戶線程,則返回系統(tǒng)提示 msg=您所發(fā)送的用戶名昵稱不存在??!。 } else{ sendMsg(i,tempMsg)。 //找到目的客戶線程并轉(zhuǎn)發(fā) } } else{ //為全體聊天,全體轉(zhuǎn)發(fā) int i=0。 for(。i()。i++) sendMsg(i,tempMsg)。 } return msg。 } private void sendMsg(int index,String msg){ //向特定客戶轉(zhuǎn)發(fā),msg為轉(zhuǎn)發(fā)信息 Socket tempSocket=(index).socket。 //index為客戶在clientVector中位置 try{ PrintWriter pw=new PrintWriter((),true)。 (msg)。 } catch(IOException printError){} } public void run(){ //建立讀寫流 String msg=null。 InputStreamReader isr=null。 BufferedReader br=null。 try{ isr=new InputStreamReader(())。 br=new BufferedReader(isr)。 } catch(IOException inOutError){ (無法與客戶建立流!!)。 delSocket()。 return。 } do{ try{ msg=()。 } catch(IOException readError){ (讀取流數(shù)據(jù)錯誤??!)。 delSocket()。 return。 } (msg)。 msg=msgForward(msg)。 //處理讀取的數(shù)據(jù) if(()==true){ //若有系統(tǒng)提示返回,則返回系統(tǒng)提示 try{ PrintWriter pw=new PrintWriter((),true)。 (msg)。 } catch(IOException printError){} } } while(true)。 }}public class ChatServer { public static void main(String args[]){ ServerSocket serverSocket=null。 Socket socket=null。 SocketThread st。 try{ serverSocket=new ServerSocket(8324)。 //監(jiān)聽端口8324 (服務(wù)器啟動成功,正在監(jiān)聽8324端口!!)。 } catch(IOException e){ (不能使用端口8324,無法啟動服務(wù)器!!)。 return。 } while(true){ try{ socket=()。 //獲得連接,并建立Socket } catch(IOException e){ (不能建立連接:+().toString()+/+())。 } st=new SocketThread(socket)。 //創(chuàng)建新線程 (建立連接:+().toString()+/+())。 ()。 //開始新線程 } }}客戶端ChartClient主要代碼:package ch02。private void initSocket(){ //對socket的初始化 try{ transferSocket=new Socket(localhost,8324)。 //與服務(wù)器建立連接 ReceiveThread rt=new ReceiveThread(transferSocket,this)。 ()。 //開啟新線程用于讀取數(shù)據(jù)流 } catch(IOExcept
點擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1