private void btnConnect_Click(object sender, EventArgs e) { BravaConnection myConnection = new BravaConnection(); myConnection.BravaIP = System.Net.IPAddress.Parse(txtIPAddr.Text); myConnection.BravaPort = Int16.Parse(txtIPPort.Text); RequestType myRequest = new RequestType(); BravaSocket mySocket = new BravaSocket(myRequest, myConnection); try { mySocket.OpenConnection(); mySocket.DoTransaction(); myConnection.rqStream.Close(); myRequest.ParseResultStream(); MessageBox.Show(myRequest.ResultXML.OuterXml); } catch (Exception) { mySocket.SocketClient.Close(); throw; } }
private void btnConnect_Click(object sender, EventArgs e) { BravaConnection myConnection = new BravaConnection(); myConnection.BravaIP = System.Net.IPAddress.Parse(txtIPAddr.Text); myConnection.BravaPort = Int16.Parse(txtIPPort.Text); RequestType myRequest = new RequestType(); BravaSocket mySocket = new BravaSocket(myRequest, myConnection); try { mySocket.DoTransaction(); if (myRequest.State == BravaTransaction.TransactionState.Completed) { myRequest.ParseResultStream(); } if (myRequest.State == BravaTransaction.TransactionState.Failed) { MessageBox.Show("Transaction Failed."); } else { // Transaction Result is now valid. MessageBox.Show(myRequest.ResultXML.OuterXml); } //mySocket.OpenConnection(); //mySocket.DoTransaction(); //myConnection.rqStream.Close(); //myRequest.ParseResultStream(); //MessageBox.Show(myRequest.ResultXML.OuterXml); } catch (Exception) { mySocket.SocketClient.Close(); throw; } }
private void btnSingleConnect_Click(object sender, EventArgs e) { if (cmbListOfIPAddress.Text != string.Empty) { BravaConnection myConnection = new BravaConnection(); myConnection.BravaIP = System.Net.IPAddress.Parse(cmbListOfIPAddress.Text); myConnection.BravaPort = (Int16)numDeviceProtocolPortNum.Value; RequestType myRequest = new RequestType(); BravaSocket mySocket = new BravaSocket(myRequest, myConnection); try { mySocket.OpenConnection(); mySocket.DoTransaction(); myConnection.rqStream.Close(); myRequest.ParseResultStream(); MessageBox.Show(myRequest.ResultXML.OuterXml); } catch (Exception) { mySocket.SocketClient.Close(); throw; } } }