yairm210 / Unciv

Open-source Android/Desktop remake of Civ V
Mozilla Public License 2.0
8.57k stars 1.58k forks source link

Problems in hosting multiplayer servers #6445

Closed mifanjia closed 2 years ago

mifanjia commented 2 years ago

PS C:\Users\管理员\Desktop\2> java -cp Unciv.jar com.unciv.app.desktop.UncivServer Server will run on 8080 port, you can use '-port=XXXX' custom port. C:\Users\管理员\Desktop\2\MultiplayerFiles 16:23:08.986 [main] INFO ktor.application - Autoreload is disabled because the development mode is off. 16:23:09.162 [main] INFO ktor.application - Responding at http://0.0.0.0:8080 16:23:09.166 [main] INFO ktor.application - Application started in 0.206 seconds. 16:23:09.181 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework 16:23:09.318 [main] DEBUG io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false 16:23:09.320 [main] DEBUG io.netty.util.internal.PlatformDependent0 - Java version: 8 16:23:09.322 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available 16:23:09.324 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available 16:23:09.326 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available 16:23:09.327 [main] DEBUG io.netty.util.internal.PlatformDependent0 - direct buffer constructor: available 16:23:09.329 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true 16:23:09.330 [main] DEBUG io.netty.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable prior to Java9 16:23:09.330 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.(long, int): available 16:23:09.330 [main] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available 16:23:09.332 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: C:\Users\管理员\AppData\Local\Temp (java.io.tmpdir) 16:23:09.333 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model) 16:23:09.334 [main] DEBUG io.netty.util.internal.PlatformDependent - Platform: Windows 16:23:09.337 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: 2373451776 bytes 16:23:09.337 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1 16:23:09.338 [main] DEBUG io.netty.util.internal.CleanerJava6 - java.nio.ByteBuffer.cleaner(): available 16:23:09.339 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false 16:23:10.724 [main] DEBUG io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 16 16:23:10.747 [main] DEBUG io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024 16:23:10.748 [main] DEBUG io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096 16:23:10.759 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false 16:23:10.759 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512 16:23:10.772 [main] DEBUG io.netty.util.internal.PlatformDependent - org.jctools-core.MpscChunkedArrayQueue: available 16:23:10.888 [main] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.processId: 45976 (auto-detected) 16:23:10.893 [main] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv4Stack: false 16:23:10.893 [main] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv6Addresses: false 16:23:12.118 [main] DEBUG io.netty.util.NetUtilInitializations - Loopback interface: lo (Software Loopback Interface 1, 127.0.0.1) 16:23:12.120 [main] DEBUG io.netty.util.NetUtil - Failed to get SOMAXCONN from sysctl and file \proc\sys\net\core\somaxconn. Default: 200 16:23:13.547 [main] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.machineId: 3c:91:80:ff:fe:6d:9a:09 (auto-detected) 16:23:13.575 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level: simple 16:23:13.576 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.targetRecords: 4 16:23:13.629 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 16 16:23:13.630 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 16 16:23:13.630 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192 16:23:13.630 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11 16:23:13.631 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216 16:23:13.631 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256 16:23:13.631 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64 16:23:13.632 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768 16:23:13.632 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192 16:23:13.632 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimIntervalMillis: 0 16:23:13.633 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.useCacheForAllThreads: true 16:23:13.633 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023 16:23:13.657 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: pooled 16:23:13.658 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 0 16:23:13.658 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384

屏幕截图 2022-03-27 162422

After adding IP to the client, the response of the server is as follows:

16:23:53.695 [eventLoopGroupProxy-3-1] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.checkAccessible: true 16:23:53.695 [eventLoopGroupProxy-3-1] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.checkBounds: true 16:23:53.698 [eventLoopGroupProxy-3-1] DEBUG io.netty.util.ResourceLeakDetectorFactory - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@2ad60319 16:23:53.849 [eventLoopGroupProxy-3-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacityPerThread: 4096 16:23:53.849 [eventLoopGroupProxy-3-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.ratio: 8 16:23:53.850 [eventLoopGroupProxy-3-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.chunkSize: 32 16:23:53.850 [eventLoopGroupProxy-3-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.blocking: false

When creating multiple people on the client: 屏幕截图 2022-03-27 162508

16:24:45.406 [eventLoopGroupProxy-4-2] ERROR ktor.application - Unhandled: PUT - /files/994ffcdf-1936-47a7-b005-794736494d7b_Preview java.lang.NoSuchMethodError: java.io.InputStream.readAllBytes()[B at com.unciv.app.desktop.UncivServer$main$2$1$2$1.invokeSuspend(UncivServer.kt:42) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

What went wrong? Can you fix him? Or is there a solution? thank you!

By the way, the Android version seems to have the following problems no matter what is added: Awaiting response..ss Failed! Screenshot_2022-03-27-12-20-40-135_com unciv app

SomeTroglodyte commented 2 years ago

Studio probably flags InputStream.readAllBytes as Inappropriate blocking method call for a reason.

heipizhu4 commented 2 years ago

6425 Are they similar?

mifanjia commented 2 years ago

6425 Are they similar?

Yes