[MessagePackObject] public class InitialConnectionData { /* [SerializationConstructor] public InitialConnectionData(string pcName, string dnsIpAddr, string osVersion) { PCName = pcName; DnsIpAddr = dnsIpAddr; OSVersion = osVersion; } */ [Key(0)] public string PCName { get; set; } [Key(1)] public string MachineIPAddr { get; set; } [IgnoreMember] public string DnsIpAddr { get; set; } [IgnoreMember] public Socket LinkedSocket { get; set; } [Key(3)] public string OSVersion { get; set; }
var sendData = new SocketSendData( /*new InitialConnectionData(Helpers.GetPCDisplayName(), Helpers.GetIPAddress(), Helpers.GetOSVersion())*/ new InitialConnectionData { PCName = Helpers.GetPCDisplayName(), MachineIPAddr = Helpers.GetIPAddress(), OSVersion = Helpers.GetOSVersion() });
var buf = MessagePackSerializer.Serialize(sendData);
byte[] recBuf = new byte[received]; Array.Copy(buffer, recBuf, received); string text = Encoding.ASCII.GetString(recBuf); Console.WriteLine("Received Text: " + text); string[] brokenText = text.Split(":".ToCharArray()); Console.WriteLine("EventName: " + brokenText[0]);