苏州平台访问地址增加

This commit is contained in:
Hinse 2022-07-15 09:29:49 +08:00
parent a60eb4f951
commit cc9cd8b00f
3 changed files with 20 additions and 11 deletions

2
.gitignore vendored
View File

@ -31,3 +31,5 @@
/Waste.CreateDB/obj
/Waste.SocketService.cs/bin
/Waste.SocketService.cs/obj
/WasteHexTest/obj
/WasteHexTest/bin

View File

@ -0,0 +1 @@
https://iot.ljflytjl.cn/Developer/Devices

View File

@ -10,12 +10,12 @@ namespace WasteConsoleTest
{
public class WSocketClientHelp
{
ClientWebSocket ws = null;
Uri uri = null;
bool isUserClose = false;//是否最后由用户手动关闭
public static string Secret = "T2hZmT3LhIvl0a0E";
public static string SecretHash = "bvfEFN9CegW1SLEOlOGA5d+ht3RlXrmAOAr099AG7K8=";
public static string deviceid = "08d97f54-c0f6-4f57-81aa-296f93be7eb2";
private ClientWebSocket ws = null;
private Uri uri = null;
private bool isUserClose = false;//是否最后由用户手动关闭
public static string Secret = "ai5ak2Q5TpkOLO4T";
public static string SecretHash = "6c29321e21e9c202";
public static string deviceid = "08d99b6b-a16f-4a5a-81ad-ffeaa9fdc94e";
// <summary>
/// WebSocket状态
@ -26,20 +26,24 @@ namespace WasteConsoleTest
/// 包含一个数据的事件
/// </summary>
public delegate void MessageEventHandler(object sender, string data);
public delegate void ErrorEventHandler(object sender, Exception ex);
/// <summary>
/// 连接建立时触发
/// </summary>
public event EventHandler OnOpen;
/// <summary>
/// 客户端接收服务端数据时触发
/// </summary>
public event MessageEventHandler OnMessage;
/// <summary>
/// 通信发生错误时触发
/// </summary>
public event ErrorEventHandler OnError;
/// <summary>
/// 连接关闭时触发
/// </summary>
@ -134,8 +138,8 @@ namespace WasteConsoleTest
Close(ws.CloseStatus.Value, ws.CloseStatusDescription + netErr);
}
});
}
/// <summary>
/// 增加记录分隔符
/// </summary>
@ -146,6 +150,7 @@ namespace WasteConsoleTest
List<byte> t = new List<byte>(data) { 0x1e };//0x1e record separator
return t.ToArray();
}
//删除记录分隔符
private static byte[] RemoveSeparator(byte[] data)
{
@ -153,6 +158,7 @@ namespace WasteConsoleTest
t.Remove(0x1e);
return t.ToArray();
}
/// <summary>
/// 获取时间戳
/// </summary>
@ -163,6 +169,7 @@ namespace WasteConsoleTest
int timestamp = Convert.ToInt32((DateTime.Now - dateTimeStart).TotalSeconds);
return timestamp;
}
/// <summary>
/// 使用连接发送文本消息
/// </summary>
@ -225,7 +232,6 @@ namespace WasteConsoleTest
}
catch (Exception ex)
{
}
ws.Abort();