Posted to tcl by Napier at Wed Sep 24 07:57:42 GMT 2014view pretty

proc onData {socketID data} {
	puts "Data has been Received from the Socket ID $socketID"
	puts "$data "
	switch -glob -- $data {
		"*login:*" {
			puts "Device is Requesting Login Credentials, Sending Now"
			catch {send $socketID "$::login\r\n"}
		}
		"*password:*" {
			puts "Device is Requesting Password Credentials, Sending Now"
			catch {send $socketID "$::password\r\n"}
		}
		"*GNET*" {
			puts "Device is Awaiting Commands"
		}
		default {puts "Unknown Data Received from Device"}
	}
}