繁体   English   中英

Kryonet服务器未收到注册的课程

[英]Kryonet server not receiving a registered class

我正在使用kryonet进行简单的聊天。 我没有问题发送消息。 但是由于某种原因,当我发送附件时,服务器只是不响应。 我正在尝试发送文件(转换为缓冲区数组)以及附件类中的一些信息。

当我发送消息时,服务器通常会收到消息源:

public class Message {

private String username;
private String message;
private int ID;

public Message(){

}

public Message(String name, String message, int ID){
    this.username = name;
    this.message = message;
    this.ID = ID;
}

public String getUsername() {
    return username;
}

public int getID() {
    return ID;
}

public String getMessage(){
    return message;
}

}

但是,当我发送附件时,服务器未收到任何附件源:

public class Attachment{

private String username;
private int ID;
private byte[] bytes;
private String filename;

public Attachment() {

}

public Attachment(byte[] bytes, String filename ,String username, int ID) {
    this.bytes = bytes;
    this.filename = filename;
    this.username = username;
    this.ID = ID;
}


public String getFilename(){
    return filename;
}

public byte[] getBytes(){
    return bytes;
}

public String getUsername() {
    return username;
}

public int getID() {
    return ID;
}

}

没有引发任何错误。 如果有人对问题有任何想法,请告诉我。

解决了! 我从来没有发现它是什么,我只是重写了附件文件,它起作用了。

暂无
暂无

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

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