91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 28.93MB
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2023-06-14
  • 語言: Java
  • 標(biāo)簽: 微信??聊天??群聊??socket??

資源簡介

涉及到的知識點(diǎn): 1.9.png的使用,這個(gè)用來做氣泡的 2.RecyclerView滑動組建的使用,貌似要勾選Android 7.0才能使用 之前一直勾8.0折騰了很久 3.Socket連網(wǎng)通信 4.線程 5.在子線程中更新UI

資源截圖

代碼片段和文件信息

import?java.io.BufferedReader;
import?java.io.BufferedWriter;
import?java.io.IOException;
import?java.io.InputStreamReader;
import?java.io.OutputStreamWriter;
import?java.net.ServerSocket;
import?java.net.Socket;
import?java.util.ArrayList;
import?java.util.concurrent.Executor;
import?java.util.concurrent.Executors;

public?class?FWQ微信?{
public?static?ArrayList?list?=?new?ArrayList();
public?static?Executor?ex?=?Executors.newCachedThreadPool();

public?static?void?main(String[]?args)?{
ServerSocket?soo?=?null;
Socket?so?=?null;
try?{
soo?=?new?ServerSocket(61666);
String?chuangjian;
chuangjian?=?“創(chuàng)建服務(wù)器成功...“;
System.out.println(chuangjian);

while?(true)?{
so?=?soo.accept();
list.add(so);
ex.execute(new?Jie(so));
}
}?catch?(IOException?e)?{
System.out.println(“創(chuàng)建服務(wù)器失敗...“);
try?{
soo.close();
so.close();
}?catch?(IOException?e1)?{
}

}
}
}

class?Jie?implements?Runnable?{//?用于接收消息
private?Socket?so;

Jie(Socket?so)?{
this.so?=?so;
String?lianjie;
lianjie?=?“已連接?用戶IP:“?+?so.getInetAddress().getHostAddress()?+?“當(dāng)前連接數(shù):“?+?FWQ微信.list.size();
System.out.println(lianjie);
}

public?void?run()?{
BufferedReader?in?=?null;
try?{
in?=?new?BufferedReader(new?InputStreamReader(so.getInputStream()?“UTF-8“));
String?s;
while?((s?=?in.readLine())?!=?null)?{
new?Thread(new?Fa(s?so)).start();//?收到消息之后?就把收到的消息發(fā)送給除了發(fā)送者之外在所有人
}
FWQ微信.list.remove(so);
String?tuichu;
tuichu?=?“已退出?用戶IP:“?+?so.getInetAddress().getHostAddress()?+?“當(dāng)前連接數(shù):“?+?FWQ微信.list.size();
System.out.println(tuichu);
in.close();
so.close();
}?catch?(IOException?e)?{
FWQ微信.list.remove(so);
String?tuichu;
tuichu?=?“已退出?用戶IP:“?+?so.getInetAddress().getHostAddress()?+?“當(dāng)前連接數(shù):“?+?FWQ微信.list.size();
System.out.println(tuichu);
try?{
in.close();
so.close();
}?catch?(IOException?e1)?{
}
}
}
}

class?Fa?implements?Runnable?{//?發(fā)送消息
private?String?s;
private?Socket?ss;

Fa(String?s?Socket?so)?{
this.s?=?s;
ss?=?so;
}

public?void?run()?{
Socket?so;

try?{
for?(int?i?=?0;?i? so?=?FWQ微信.list.get(i);
if?(so?==?ss)
continue;//?收到消息之后?就把收到的消息發(fā)送給除了發(fā)送者之外在所有人。ss為發(fā)送者
BufferedWriter?out?=?new?BufferedWriter(new?OutputStreamWriter(so.getOutputStream()?“UTF-8“));
out.write(s?+?“\r\n“);
out.flush();
}
}?catch?(IOException?e)?{
System.out.println(“群發(fā)異常“);

}

}

}

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件???????2718??2018-05-31?15:01??山寨版微信\FWQ微信.java

?????文件????????127??2018-05-27?13:58??山寨版微信\shanzhaibanweixin\.gitignore

?????文件??????????1??2018-05-31?14:48??山寨版微信\shanzhaibanweixin\.gradle\4.1\fileChanges\last-build.bin

?????文件?????????17??2018-05-31?14:48??山寨版微信\shanzhaibanweixin\.gradle\4.1\fileContent\fileContent.lock

?????文件?????261169??2018-05-31?14:48??山寨版微信\shanzhaibanweixin\.gradle\4.1\fileHashes\fileHashes.bin

?????文件?????????17??2018-05-31?14:48??山寨版微信\shanzhaibanweixin\.gradle\4.1\fileHashes\fileHashes.lock

?????文件??????20027??2018-05-27?15:11??山寨版微信\shanzhaibanweixin\.gradle\4.1\fileHashes\resourceHashesCache.bin

?????文件?????953493??2018-05-31?14:48??山寨版微信\shanzhaibanweixin\.gradle\4.1\javaCompile\classAnalysis.bin

?????文件?????355607??2018-05-27?15:11??山寨版微信\shanzhaibanweixin\.gradle\4.1\javaCompile\jarAnalysis.bin

?????文件?????????17??2018-05-31?14:48??山寨版微信\shanzhaibanweixin\.gradle\4.1\javaCompile\javaCompile.lock

?????文件?????815961??2018-05-31?14:48??山寨版微信\shanzhaibanweixin\.gradle\4.1\javaCompile\taskHistory.bin

?????文件??????26006??2018-05-31?14:48??山寨版微信\shanzhaibanweixin\.gradle\4.1\javaCompile\taskJars.bin

?????文件????2899535??2018-05-31?14:48??山寨版微信\shanzhaibanweixin\.gradle\4.1\taskHistory\fileSnapshots.bin

?????文件??????81409??2018-05-31?14:48??山寨版微信\shanzhaibanweixin\.gradle\4.1\taskHistory\taskHistory.bin

?????文件?????????17??2018-05-31?14:48??山寨版微信\shanzhaibanweixin\.gradle\4.1\taskHistory\taskHistory.lock

?????文件??????????0??2018-05-27?13:58??山寨版微信\shanzhaibanweixin\.gradle\buildOutputCleanup\built.bin

?????文件?????????51??2018-05-27?13:58??山寨版微信\shanzhaibanweixin\.gradle\buildOutputCleanup\cache.properties

?????文件??????????2??2018-05-31?14:48??山寨版微信\shanzhaibanweixin\.gradle\buildOutputCleanup\cache.properties.lock

?????文件????????626??2018-05-27?13:58??山寨版微信\shanzhaibanweixin\.idea\gradle.xml

?????文件????????533??2018-05-27?13:58??山寨版微信\shanzhaibanweixin\.idea\libraries\android_arch_core_common_1_0_0_jar.xml

?????文件????????548??2018-05-27?13:58??山寨版微信\shanzhaibanweixin\.idea\libraries\android_arch_lifecycle_common_1_0_0_jar.xml

?????文件????????658??2018-05-27?13:58??山寨版微信\shanzhaibanweixin\.idea\libraries\android_arch_lifecycle_runtime_1_0_0.xml

?????文件????????742??2018-05-27?13:58??山寨版微信\shanzhaibanweixin\.idea\libraries\com_android_support_animated_vector_drawable_26_1_0.xml

?????文件????????682??2018-05-27?13:58??山寨版微信\shanzhaibanweixin\.idea\libraries\com_android_support_appcompat_v7_26_1_0.xml

?????文件????????501??2018-05-27?13:58??山寨版微信\shanzhaibanweixin\.idea\libraries\com_android_support_constraint_constraint_layout_1_1_0.xml

?????文件????????425??2018-05-27?13:58??山寨版微信\shanzhaibanweixin\.idea\libraries\com_android_support_constraint_constraint_layout_solver_1_1_0_jar.xml

?????文件????????697??2018-05-27?14:08??山寨版微信\shanzhaibanweixin\.idea\libraries\com_android_support_recyclerview_v7_26_1_0.xml

?????文件????????608??2018-05-27?13:58??山寨版微信\shanzhaibanweixin\.idea\libraries\com_android_support_support_annotations_26_1_0_jar.xml

?????文件????????609??2018-05-27?13:58??山寨版微信\shanzhaibanweixin\.idea\libraries\com_android_support_support_annotations_27_1_1_jar.xml

?????文件????????692??2018-05-27?13:58??山寨版微信\shanzhaibanweixin\.idea\libraries\com_android_support_support_compat_26_1_0.xml

............此處省略2430個(gè)文件信息

評論

共有 條評論