IODefinitions.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /***************************************************************************
  2. *
  3. * Project _____ __ ____ _ _
  4. * ( _ ) /__\ (_ _)_| |_ _| |_
  5. * )(_)( /(__)\ )( (_ _)(_ _)
  6. * (_____)(__)(__)(__) |_| |_|
  7. *
  8. *
  9. * Copyright 2018-present, Leonid Stryzhevskyi <lganzzzo@gmail.com>
  10. *
  11. * Licensed under the Apache License, Version 2.0 (the "License");
  12. * you may not use this file except in compliance with the License.
  13. * You may obtain a copy of the License at
  14. *
  15. * http://www.apache.org/licenses/LICENSE-2.0
  16. *
  17. * Unless required by applicable law or agreed to in writing, software
  18. * distributed under the License is distributed on an "AS IS" BASIS,
  19. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20. * See the License for the specific language governing permissions and
  21. * limitations under the License.
  22. *
  23. ***************************************************************************/
  24. #include "IODefinitions.hpp"
  25. #if defined(WIN32) || defined(_WIN32)
  26. #include <winsock2.h>
  27. #endif
  28. namespace oatpp {
  29. bool isValidIOHandle(v_io_handle handle) {
  30. #if defined(WIN32) || defined(_WIN32)
  31. return handle != INVALID_SOCKET;
  32. #else
  33. return handle >= 0;
  34. #endif
  35. }
  36. }