menacher / java-game-server

Jetserver is a high speed nio socket based multiplayer java game server written using Netty and Mike Rettig's Jetlang.It is specifically tuned for network based multiplayer games and supports TCP and UDP network protocols.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

param charSet ignored in NettyUtils.writeStrings(Charset charSet, String... msgs)

zhijunsheng opened this issue · comments

When I read the source code of method writeStrings(..) of class NettyUtils in jetserver, it seems to me that this line

ChannelBuffer theBuffer = writeString(msg);

should be

ChannelBuffer theBuffer = writeString(msg, charSet);

because the param charSet is not used otherwise.

Here is the original code:

public static ChannelBuffer writeStrings(Charset charSet, String... msgs)
{
    ChannelBuffer buffer = null;
    for (String msg : msgs)
    {
        if (null == buffer)
        {
            buffer = writeString(msg,charSet);
        }
        else
        {
            ChannelBuffer theBuffer = writeString(msg); // <--------- line in question
            if(null != theBuffer)
            {
                buffer = ChannelBuffers.wrappedBuffer(buffer,theBuffer);
            }
        }
    }
    return buffer;
}

Excuse me I have another question:
How and where to ask question like "what is the recommended way to add signup, password changing etc. features when using jetserver"?

Thanks a lot for this great open source project!

I have fixed the issue, now. Binaries are not updated so please build from code. I have just now created a new google group for jetserver. You can raise such issues there. B.t.w user credentials managing is very simplistic in jetserver see issue/feature #22.
But let me try to explain here. Jetserver does not as such provide a "user interface" to add users, manage passwords etc since that is not its purpose, even though it can be a module written for it. One simplistic implementation can be like this. You store all your user information in say mysql and in jetserver when you get username password and room connection key while the LOG_IN event is received you can do "SELECT * FROM MY_USER_TABLE WHERE USER_NAME="username form LOG_IN" AND PASSWORD="password from LOG_IN"; If player is retrievable you go ahead with connection in the "LookupService" object else you disconnect. You can use whatever UI you want to manage users in the backend database you have.