Compare commits

...

4 Commits

Author SHA1 Message Date
dbace3d454
更新 gradle.properties
All checks were successful
Gitea Actions Build / Build (push) Successful in 50s
2025-07-10 08:48:12 +08:00
b033732949
删除 build.yaml
Some checks failed
Gitea Actions Build / Build (push) Has been cancelled
2025-07-10 08:47:54 +08:00
2ec34c056f
更新 build.gradle.kts
Some checks failed
Gitea Actions Build / Build (push) Has been cancelled
2025-07-10 08:47:48 +08:00
0d420d57f2
no message
All checks were successful
Gitea Actions Build / Build (push) Successful in 52s
2025-07-05 22:50:43 +08:00
6 changed files with 14 additions and 42 deletions

View File

@ -1,4 +1,3 @@
import java.security.MessageDigest import java.security.MessageDigest
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
@ -38,8 +37,8 @@ dependencies {
testRuntimeOnly("org.junit.platform:junit-platform-launcher") testRuntimeOnly("org.junit.platform:junit-platform-launcher")
implementation("org.jetbrains:annotations:24.0.0") implementation("org.jetbrains:annotations:24.0.0")
annotationProcessor("org.jetbrains:annotations:24.0.0") annotationProcessor("org.jetbrains:annotations:24.0.0")
implementation("com.mingliqiye:network-endpoint:1.0.2") implementation("com.mingliqiye:network-endpoint:1.0.4")
implementation("com.mingliqiye:string-utilts:1.0.4") implementation("com.mingliqiye:string-utils:1.0.4")
} }
tasks.test { tasks.test {

View File

@ -1,27 +0,0 @@
name: Gitea Actions Build
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on:
push:
branches:
- master
jobs:
Build:
runs-on: ubuntu-dev
steps:
- name: Check out repository code
uses: https://git.mingliqiye.com/Actions/checkout@v4
- name: build-test
run: |
source gradle.properties
gradle
gradle build-jar
- name: Releases
run: |
source gradle.properties
SHA=${{gitea.sha}}
curl -o- https://git.mingliqiye.com/Actions/com.mingliqiye.gitea.releases/raw/branch/master/install.sh | bash
FILENAME="${GROUPSID}-${VERSIONS}.jar"
java -jar com.mingliqiye.gitea.releases.jar -s "${{gitea.server_url}}" -o "${{gitea.repository_owner}}" -r ${{gitea.event.repository.name}} -t "${{gitea.token}}" -ti "Auto releases ${{gitea.sha}} ${VERSIONS}" -b "# Auto releases wtih ${{gitea.event.head_commit.message}} - [${{gitea.sha}}](${{gitea.event.head_commit.url}})" -tn "Auto-Releases-${VERSIONS}-${SHA:0:10}" -a "build/libs"

View File

@ -1,5 +1,5 @@
GROUPSID=com.mingliqiye GROUPSID=com.mingliqiye
ARTIFACTID=socket-utilts ARTIFACTID=socket-utilts
VERSIONS=1.0.4 VERSIONS=1.0.7
MAINCLASS=com.mingliqiye.Main MAINCLASS=com.mingliqiye.Main
JDKVERSIONS=1.8 JDKVERSIONS=1.8

View File

@ -6,7 +6,7 @@ import java.net.ServerSocket;
public class DefTcpServerImplementation extends TcpServerImplementation { public class DefTcpServerImplementation extends TcpServerImplementation {
boolean connect(TcpSocketClient client, String id) { public boolean connect(TcpSocketClient client, String id) {
System.out.println( System.out.println(
StringUtil.format( StringUtil.format(
"客户端 {} ID={} 连接成功", "客户端 {} ID={} 连接成功",
@ -17,7 +17,7 @@ public class DefTcpServerImplementation extends TcpServerImplementation {
return true; return true;
} }
void disconnect(TcpSocketClient client, String id) { public void disconnect(TcpSocketClient client, String id) {
System.out.println( System.out.println(
StringUtil.format( StringUtil.format(
"客户端 {} ID={} 断开连接", "客户端 {} ID={} 断开连接",
@ -27,7 +27,7 @@ public class DefTcpServerImplementation extends TcpServerImplementation {
); );
} }
void reception( public void reception(
TcpSocketClient client, TcpSocketClient client,
BufferBytesEntity bufferBytesEntity BufferBytesEntity bufferBytesEntity
) { ) {
@ -46,7 +46,7 @@ public class DefTcpServerImplementation extends TcpServerImplementation {
); );
} }
void started(ServerSocket serverSocket) { public void started(ServerSocket serverSocket) {
System.out.println( System.out.println(
StringUtil.format( StringUtil.format(
"服务器启动 监听 {}", "服务器启动 监听 {}",
@ -57,7 +57,7 @@ public class DefTcpServerImplementation extends TcpServerImplementation {
); );
} }
void closed() { public void closed() {
System.out.println("服务器已经关闭"); System.out.println("服务器已经关闭");
} }
} }

View File

@ -14,21 +14,21 @@ public abstract class TcpServerImplementation {
* @param id 客户端ID * @param id 客户端ID
* @return 是否允许连接 * @return 是否允许连接
*/ */
abstract boolean connect(TcpSocketClient client, String id); public abstract boolean connect(TcpSocketClient client, String id);
/** /**
* 断开连接回调函数 * 断开连接回调函数
* @param client 客户端 * @param client 客户端
* @param id 客户端ID * @param id 客户端ID
*/ */
abstract void disconnect(TcpSocketClient client, String id); public abstract void disconnect(TcpSocketClient client, String id);
abstract void reception( public abstract void reception(
TcpSocketClient client, TcpSocketClient client,
BufferBytesEntity bufferBytesEntity BufferBytesEntity bufferBytesEntity
); );
abstract void started(ServerSocket serverSocket); public abstract void started(ServerSocket serverSocket);
abstract void closed(); public abstract void closed();
} }

View File

@ -63,7 +63,7 @@ public class TcpSocketServer extends Thread implements AutoCloseable {
); );
if (!tcpServerImplementation.connect(tcpSocketClient, uuid)) { if (!tcpServerImplementation.connect(tcpSocketClient, uuid)) {
tcpSocketClient.close(); tcpSocketClient.close();
return; continue;
} }
clientMap.put(uuid, tcpSocketClient); clientMap.put(uuid, tcpSocketClient);
tcpSocketClient.start(); tcpSocketClient.start();