Refactoring
Send sending check
Refactored buffer sending
Socket closing improved