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