Some of best sources about Socrates' philosophical views are the early dialogues of his student Plato, who attempted to provide a faithful picture of the methods and teachings of the master. However, these writings more often expressed philosophical positions developed by Plato long after Socrates' death.
Socrates thought that one should never return injustice for injustice or harm for harm. He reasoned that there is no difference between doing an injustice to a person and harming the person. In Crito, he argued that, even though he may be wrongly convicted, he would not to try to escape from prison since he would be unjustly breaking the laws of Athens. However, what about when defending himself from an attack. His actions in this case may cause harm and they would be just.
Socrates had faced self-defense situations when he served as a foot soldier in the Athenian Army, so it may be assumed he had to wound or kill the enemy at some point. How did he deal with this dilemma?
It appears Socrates believed that his actions during war did not cause harm to the enemy. He believed that that physically preventing an attack from succeeding provided the attacker with a greater good by preserving the attacker's psyche and thus was ultimately not harmful to the attacker. It appears Socrates was trying to rationalize how his actions were in agreement with his beliefs.
Socrates' definition of harm is not easily discerned since he never defined it, so we have to try to discern his definition from writings by others about his thoughts. In the Apology, when Socrates argues with Meletus about corrupting the young, Socrates states that bad people do harmful things to their closest neighbors and that no one wants to be injured. Socrates thinks that if he corrupts those around him, he will likely be harmed in return by those he corrupted. Therefore, since he does not want to be harmed, either he does not corrupt or, if he corrupts, he does it unwillingly.