What I can say, is learn your protocols.
As a former sysadmin, it was usually this process: port knocking, malformed packets, log and IDs trips, and a lost connection.
Magazines like hacki9g, 2600, circuit cellar, info security weekly, etc should become normal reading.
Get a VPs account and hack it.
The problem isn’t learning what code do in programing. Rather its understanding what the code does and thats something that can only be learned by your own experience
A better alternative is going to publishers like Apress and see if they have books that are relevant to your launguage.