public void serialEvent(SerialPortEvent spe) {

		int[] msgToChildren = NetworkProtocol.msgToChildren;
		if (spe.getEventType() == SerialPortEvent.DATA_AVAILABLE) {//If one byte of data came in


			try {
				byte charVal = (byte)input.read();

				if (charVal == START_BYTE && dataPacketFlag == false) { //Stores start byte
					dataPacketFlag = true;

					netText[byteCounter++] = charVal;
					
					window.logAreaText.append("RxD-");
					logText = new String(new byte[] {charVal});
					window.logAreaText.append(logText);
				}

				else if (charVal != STOP_BYTE && dataPacketFlag == true) { //Stores actual data
					logText = new String(new byte[] {charVal});
					window.logAreaText.append(logText);

					netText[byteCounter++] = charVal;					
				}

				else if (charVal == STOP_BYTE && dataPacketFlag == true) { //Stores stop byte
					dataPacketFlag = false;

					if (netText[1] != msgToChildren[0]) { //botID parent...						
						parseChildMsg(byteCounter);	
						printChildMsg(byteCounter);
						NetworkProtocol.setSuccessPcktRxd(true);
						numRxD++;
					} 

					logText = new String(new byte[] {charVal});
					window.logAreaText.append(logText);
					window.logAreaText.append("\n");

					byteCounter = 0;
				}


			} catch (Exception e) {
				logText = "Failed to read data." + "(" + e.toString() + ")";
				window.logAreaText.setForeground(Color.red);
				window.logAreaText.append(logText + "\n");
				System.err.println(e.toString());
			}
		}
	}