ios-hooks/AppRunMan/server/MySimpleServer.m
2025-12-01 10:07:51 +08:00

61 lines
1.6 KiB
Objective-C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// MySimpleServer.m
// nochange
//
// Created by mac on 2024/7/21.
//
#import <Foundation/Foundation.h>
#import "MyScriptTask.h"
#import "XSHelper.h"
#import <UIKit/UIKit.h>
#import "IPhoneHertbeat.h"
#import "MySimpleServer.h"
#import "IosSystemCmd.h"
#import "MyAdServer.h"
#import "XSHackIos.h"
#import "MyAdTask2.h"
#import "XUDPServer.h"
void startSimpleServer(void) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// 初始化信号处理
registerSignalHandler();
NSLog(@"XS- start server");
// 创建专用的串行队列
dispatch_queue_t serverQueue = dispatch_queue_create("com.xzyshell.serverqueue", DISPATCH_QUEUE_SERIAL);
// 在主队列初始化关键服务
dispatch_async(dispatch_get_main_queue(), ^{
[[IPhoneHertbeat sharedInstance] start];
// [[IosSystemCmd sharedInstance] start];
});
// 在服务器队列中处理服务器相关操作
dispatch_async(serverQueue, ^{
@autoreleasepool {
// 服务器端
// MessagePortServer *server = [[MessagePortServer alloc] init];
// [server startServer];
XUDPServer *udpserver = [XUDPServer sharedInstance];
[udpserver start];
// 移除显式运行NSRunLoop让GCDAsyncUdpSocket在自己的队列中管理
// NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
// [runLoop addPort:[NSPort port] forMode:NSDefaultRunLoopMode];
// [runLoop run];
}
});
});
}