It's called scouting...
If you scout, you'll know if your opponent is ling rushing.
Also, if your opponent starts making a pylon/bunker/etc. in your base, then you should start attacking it with workers and/or hurry up and get a military structure.
1) How can I prevent a unit from running away when hit (the unit cannot attack)?
2) How can I detect collisions?
3) How can I change the creation point of a missile fired by a unit?
Thanks!