Exemplo n.º 1
0
 private void Stop()
 {
     if (socket != null)
     {
         socket.Dispose();
         socket = null;
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TCNetSocketException"/> class.
 /// </summary>
 /// <param name="socket">The socket that has thrown this exception.</param>
 /// <param name="message">The message explaining the error that ocurred.</param>
 /// <param name="innerException">The inner exception.</param>
 public TCNetSocketException(TCNetSocket socket, string message, Exception innerException) : base(message, innerException)
 {
     Data["NodeId"]           = socket.NodeId;
     Data["NodeName"]         = socket.NodeName;
     Data["LocalAddress"]     = socket.LocalIP;
     Data["LocalSubnetMask"]  = socket.LocalSubnetMask;
     Data["BroadcastAddress"] = socket.BroadcastAddress;
 }
Exemplo n.º 3
0
        private void Start(CardInfo networkCard)
        {
            socket                 = new TCNetSocket(NodeType.Slave);
            socket.NodeName        = "TITAN01";
            socket.VendorName      = "AVOLITES";
            socket.DeviceName      = "TITAN";
            socket.DeviceVersion   = Assembly.GetEntryAssembly().GetName().Version;
            socket.NewPacket      += socket_NewPacket;
            socket.NewDeviceFound += Socket_NewDeviceFound;
            socket.DeviceLost     += Socket_DeviceLost;

            socket.Open(networkCard.IpAddress, networkCard.SubnetMask);
        }