修改TCP/UDP表示值
This commit is contained in:
parent
635bfa0670
commit
cfdd8eee10
|
@ -94,9 +94,9 @@ TokenClient* Token::CreateClient(ISocketHost* host)
|
|||
|
||||
auto tk = TokenConfig::Current;
|
||||
ISocket* socket = NULL;
|
||||
if(tk->Protocol == 2)
|
||||
if(tk->Protocol == 17)
|
||||
socket = CreateW5500UDP(host, tk);
|
||||
else if(tk->Protocol == 1)
|
||||
else if(tk->Protocol == 6)
|
||||
socket = CreateW5500TCP(host, tk);
|
||||
token.Port = dynamic_cast<ITransport*>(socket);
|
||||
|
||||
|
|
|
@ -322,12 +322,14 @@ void TokenClient::OnRegister(TokenMessage& msg ,Controller* ctrl)
|
|||
if(!msg.Reply || msg.Error) return;
|
||||
|
||||
auto cfg = TokenConfig::Current;
|
||||
|
||||
|
||||
RegisterMessage rm;
|
||||
rm.ReadMessage(msg);
|
||||
rm.Name.CopyTo(cfg->Name);
|
||||
rm.Name.CopyTo(cfg->Name,16,0);
|
||||
rm.Pass.CopyTo(cfg->Key);
|
||||
|
||||
|
||||
cfg->Show();
|
||||
cfg->Save();
|
||||
cfg->Show();
|
||||
|
||||
|
|
|
@ -21,10 +21,10 @@ void TokenConfig::Init()
|
|||
|
||||
SoftVer = Sys.Version;
|
||||
PingTime = 10;
|
||||
Name[15] = '\0';
|
||||
Key[15] = '\0';
|
||||
Name[16] = '\0';
|
||||
//Key[15] = '\0';
|
||||
|
||||
Protocol = 2;
|
||||
Protocol = 17;
|
||||
}
|
||||
|
||||
void TokenConfig::Show() const
|
||||
|
@ -32,7 +32,7 @@ void TokenConfig::Show() const
|
|||
#if DEBUG
|
||||
debug_printf("TokenConfig::令牌配置:\r\n");
|
||||
|
||||
debug_printf("\t协议: %s \r\n", Protocol == 2 ? "UDP" : "TCP");
|
||||
debug_printf("\t协议: %s ,%d\r\n", Protocol == 17 ? "UDP" : "TCP",Protocol);
|
||||
debug_printf("\t端口: %d \r\n", Port);
|
||||
|
||||
debug_printf("\t远程: ");
|
||||
|
|
|
@ -16,13 +16,13 @@ class TokenConfig : public ConfigBase
|
|||
public:
|
||||
byte Length; // 数据长度
|
||||
|
||||
char Name[16]; // 登录名
|
||||
char Key[16]; // 登录密码
|
||||
char Name[17]; // 登录名
|
||||
char Key[64]; // 登录密码
|
||||
ushort HardVer; // 硬件版本
|
||||
ushort SoftVer; // 软件版本
|
||||
|
||||
byte PingTime; // 心跳时间。秒
|
||||
byte Protocol; // 协议,TCP=1/UDP=2
|
||||
byte Protocol; // 协议,TCP=6/UDP=17
|
||||
ushort Port; // 本地端口
|
||||
uint ServerIP; // 服务器IP地址。服务器域名解析成功后覆盖
|
||||
ushort ServerPort; // 服务器端口
|
||||
|
|
Loading…
Reference in New Issue