Please do the oposite. Ie: always use closesocket in code and define that to close in the non windows case. This could spread and break file handling.