繁体   English   中英

Kryonet - 缓冲区溢出 - 小对象发送

[英]Kryonet - buffer overflow - small object sending

嗨。 在localhost上运行的一切都没有问题。 现在服务器设置在专业主机上。 错误总是一样的:

10-04 16:35:29.974 5730-5830/com.drkmns.gameloopballs E/AndroidRuntime:   FATAL EXCEPTION: Thread-8160
10-04 16:35:29.974 5730-5830/com.drkmns.gameloopballs E/AndroidRuntime: Process: com.drkmns.gameloopballs, PID: 5730
10-04 16:35:29.974 5730-5830/com.drkmns.gameloopballs E/AndroidRuntime: com.esotericsoftware.kryo.KryoException: Buffer overflow. Available: 0, required: 9

代码很简单:

  String host = ui.inputHost();
    try {
        client.connect(5000, host, Network.port);
        // Server communication after connection can go here, or in Listener#connected().
    } catch (IOException ex) {
        ex.printStackTrace();
    }

    name = "MOJANAZWA";
    Login login = new Login();
    login.name = name;
    client.sendTCP(login);
    TestPacket test = new TestPacket();
    while (true) {

        test.msg = "33333333333333";
        client.sendTCP(test);
    }

TestPacket类只有一个字符串。 当我通过模拟器连接一切正常。 当我在三星Galaxy S4上打开它时会抛出此异常。

已经尝试过增加Server和Client的构造函数中的缓冲区 - 没有用。

有任何想法吗?

我不知道这怎么可能 - 也许有人可以解释 - 但是睡了1毫秒的线程工作Oo

while (true) {

        test.msg = "55555444444444444444444444444444444444444444444444444444444444444455";
        client.sendTCP(test);
        synchronized (client) {
            try {
                client.wait(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM