POLUtils.AuxSvc.AuxSvcConnection.Close C# (CSharp) Méthode

Close() public méthode

Closes all AuxSvcConnection related Streams. Can be used to manually kill an AuxSvcConnection if an error is encountered before using Write(). Will result in the AuxSvc Script in POL to exit the While(connection) Loop and terminate.
public Close ( ) : void
Résultat void
        public void Close()
        {
            AuxReader.Close();
            AuxWriter.Close();
            AuxStream.Close();
            AuxSocket.Close();
        }

Usage Example

Exemple #1
0
 private void testAuxButton_Click(object sender, EventArgs e)
 {
     // Create the AuxSvc Object for your program. This will automatically
     // try to connect to your host/port and prepare you to be able to 
     // send your information to POL.
     AuxSvcConnection TestAuxSvc = new AuxSvcConnection(serverHost.Text.ToString(), Convert.ToInt32(serverPort.Text));
     if (!TestAuxSvc.Active)
     {
         MessageBox.Show("Server appears to be offline. Make sure host and port are correct.");
         return;
     }
     TestAuxSvc.Write(PackUnpack.Pack(auxSendText.Text.ToString()));
     string ReadString = TestAuxSvc.Read();
     object ReadObject = PackUnpack.Unpack(ReadString.ToString());
     ArrayList ReadArray = (ArrayList)ReadObject;
     auxRecvText.Text = ReadArray[0] + " " + ReadArray[1] + " " + ReadArray[2];
     TestAuxSvc.Close();
 }