icqsocket.h
上传用户:zslianheng
上传日期:2013-04-03
资源大小:946k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Visual C++

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *   This program is free software; you can redistribute it and/or modify  *
  4.  *   it under the terms of the GNU General Public License as published by  *
  5.  *   the Free Software Foundation; either version 2 of the License, or     *
  6.  *   (at your option) any later version.                                   *
  7.  *                                                                         *
  8.  *   copyright            : (C) 2002 by Zhang Yong                         *
  9.  *   email                : z-yong163@163.com                              *
  10.  ***************************************************************************/
  11. #ifndef _ICQ_SOCKET_H
  12. #define _ICQ_SOCKET_H
  13. #ifdef _WIN32
  14. #include <winsock.h>
  15. #define close closesocket
  16. #define EINPROGRESS WSAEWOULDBLOCK
  17. typedef int socklen_t;
  18. #else
  19. #include <unistd.h>
  20. #include <sys/types.h>
  21. #include <sys/socket.h>
  22. #include <netinet/in.h>
  23. #include <fcntl.h>
  24. #include <arpa/inet.h>
  25. #include <errno.h>
  26. #endif
  27. class SocketListener;
  28. class IcqSocket {
  29. public:
  30. static void destroy();
  31. static int createSocket(int type, SocketListener *l);
  32. static int createListenSocket(const char *name);
  33. static int acceptSocket(int listenSock, SocketListener *l);
  34. static void closeSocket(int sock);
  35. static void enableWrite(int sock);
  36. static int getSocketError();
  37. };
  38. #endif