Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
DataServer: Socket Class Reference Main Page Modules Namespaces Classes Files Directories Class List Class Index Class Hierarchy Class Members Socket Class Reference [Common] Cross-platform socket class. More... #include List of all members. Public Member Functions   Socket ()   Socket (int nPort)   ~Socket () Socket *  Accept () Socket *  AcceptWithTimeout (double dTimeout) void  Listen (int nNumPorts=5) void  BindSocket () bool  Connect (const std::string &sHostname) bool  HasData () void *  ReceiveMessageWithHeader (int &iNumOfBytesRead, double dfTimeoutInSecs=0.0) int  SendMessageWithHeader (void *pMessage, int iNumOfBytesToWrite) int  SendMessage (void *pMessage, int nMessageSize) int  ReceiveMessage (void *pMessage, int nMessageSize, int nOption=0) int  ReadMessageWithTimeout (void *pMessage, int nMessageSize, double dfTimeOut, bool &bPeerDown, int nOption=0) std::string  ClientName () void  SetReceiveTimeOut (int nTimeOut) void  SetReadTime (double dfTime) double  GetReadTime () int  GetLastError () void  SetTcpNoDelay (int nToggle) void  SetDebug (int nToggle) void  SetBroadcast (int nToggle) void  SetReuseAddr (int nToggle) void  SetKeepAlive (int nToggle) void  SetLinger (struct linger lingerOption) bool  SetSocketBlocking (int nToggle) void  SetSendBufSize (int nSendBufSize) void  SetReceiveBufSize (int nReceiveBufSize) int  GetDebug () int  GetBroadcast () int  GetReuseAddr () int  GetKeepAlive () void  GetLinger (struct linger &_lingerOption) int  GetSendBufSize () int  GetReceiveBufSize () int  GetSocketBlocking () short int  GetSocketFd () Static Public Member Functions static bool  SocketsInit () Protected Attributes int  m_nPort short int  m_nSocketFd int  m_nBlocking double  m_dfLastRead int  m_nIsLocal std::string  m_sClientHostname struct sockaddr_in *  m_pClientAddress int  m_nClientAddrStructLen char *  m_pDataBuffer int  m_iDataBufferSize int  m_iMaxPacketSize Detailed Description Cross-platform socket class. Author: Derik Schroeter, Gabe Sibley Definition at line 51 of file Socket.h. Constructor & Destructor Documentation Socket::Socket (  )  Definition at line 36 of file Socket.cpp. Socket::Socket ( int  nPort  )  Definition at line 48 of file Socket.cpp. Socket::~Socket (  )  Definition at line 72 of file Socket.cpp. Member Function Documentation Socket * Socket::Accept (  )  Accepts a connection. Creates a new socket. Definition at line 269 of file Socket.cpp. Socket * Socket::AcceptWithTimeout ( double  dTimeout  )  Definition at line 207 of file Socket.cpp. void Socket::BindSocket (  )  Binds the socket to an address and port number. Definition at line 629 of file Socket.cpp. std::string Socket::ClientName (  )  Definition at line 179 of file Socket.cpp. bool Socket::Connect ( const std::string &  sHostname  )  Connects to host (clients usually use this). Definition at line 129 of file Socket.cpp. int Socket::GetBroadcast (  )  Definition at line 893 of file Socket.cpp. int Socket::GetDebug (  )  Definition at line 878 of file Socket.cpp. int Socket::GetKeepAlive (  )  Definition at line 921 of file Socket.cpp. int Socket::GetLastError (  )  void Socket::GetLinger ( struct linger &  _lingerOption  )  Definition at line 935 of file Socket.cpp. double Socket::GetReadTime (  )  Definition at line 703 of file Socket.cpp. int Socket::GetReceiveBufSize (  )  Definition at line 960 of file Socket.cpp. int Socket::GetReuseAddr (  )  Definition at line 907 of file Socket.cpp. int Socket::GetSendBufSize (  )  Definition at line 946 of file Socket.cpp. int Socket::GetSocketBlocking (  )  Definition at line 723 of file Socket.cpp. short int Socket::GetSocketFd (  )  Definition at line 717 of file Socket.cpp. bool Socket::HasData (  )  Definition at line 316 of file Socket.cpp. void Socket::Listen ( int  nNumPorts = 5  )  Listens for connections (servers usually use this). Definition at line 305 of file Socket.cpp. int Socket::ReadMessageWithTimeout ( void *  pMessage, int  nMessageSize, double  dfTimeOut, bool &  bPeerDown, int  nOption = 0   ) Definition at line 642 of file Socket.cpp. int Socket::ReceiveMessage ( void *  pMessage, int  nMessageSize, int  nOption = 0   ) Receives a TCP message. Definition at line 608 of file Socket.cpp. void * Socket::ReceiveMessageWithHeader ( int &  iNumOfBytesRead, double  dfTimeoutInSecs = 0.0   ) Receives a TCP message, and automatically handles the necessary memory, IF the message/packet was send using SendMessageWithHeader(). The method allocates an appropriate buffer and returns a pointer to it. Subsequently it will reuse this same pointer, effectively providing zero-copy-read. The returned pointer must not be freed or deleted (!). Definition at line 350 of file Socket.cpp. int Socket::SendMessage ( void *  pMessage, int  nMessageSize   ) Sends a TCP message to a connected host. The number of bytes sent is returned. Definition at line 552 of file Socket.cpp. int Socket::SendMessageWithHeader ( void *  pMessage, int  iNumOfBytesToWrite   ) This methods adds a "header" (4 bytes) to the data to be sent, which allows ReceiveMessageWithHeader() to automatically figure the size of the packet in bytes. Definition at line 496 of file Socket.cpp. void Socket::SetBroadcast ( int  nToggle  )  Definition at line 751 of file Socket.cpp. void Socket::SetDebug ( int  nToggle  )  Definition at line 740 of file Socket.cpp. void Socket::SetKeepAlive ( int  nToggle  )  Definition at line 773 of file Socket.cpp. void Socket::SetLinger ( struct linger  lingerOption  )  Definition at line 785 of file Socket.cpp. void Socket::SetReadTime ( double  dfTime  )  Definition at line 709 of file Socket.cpp. void Socket::SetReceiveBufSize ( int  nReceiveBufSize  )  Definition at line 807 of file Socket.cpp. void Socket::SetReceiveTimeOut ( int  nTimeOut  )  Definition at line 974 of file Socket.cpp. void Socket::SetReuseAddr ( int  nToggle  )  Definition at line 762 of file Socket.cpp. void Socket::SetSendBufSize ( int  nSendBufSize  )  Definition at line 796 of file Socket.cpp. bool Socket::SetSocketBlocking ( int  nToggle  )  Definition at line 818 of file Socket.cpp. void Socket::SetTcpNoDelay ( int  nToggle  )  Definition at line 729 of file Socket.cpp. bool Socket::SocketsInit (  )  [static] Definition at line 87 of file Socket.cpp. Member Data Documentation double Socket::m_dfLastRead [protected] Definition at line 62 of file Socket.h. int Socket::m_iDataBufferSize [protected] Definition at line 69 of file Socket.h. int Socket::m_iMaxPacketSize [protected] Definition at line 69 of file Socket.h. int Socket::m_nBlocking [protected] Definition at line 61 of file Socket.h. int Socket::m_nClientAddrStructLen [protected] Definition at line 67 of file Socket.h. int Socket::m_nIsLocal [protected] Definition at line 63 of file Socket.h. int Socket::m_nPort [protected] Definition at line 59 of file Socket.h. short int Socket::m_nSocketFd [protected] Definition at line 60 of file Socket.h. struct sockaddr_in* Socket::m_pClientAddress [read, protected] Definition at line 66 of file Socket.h. char* Socket::m_pDataBuffer [protected] Definition at line 68 of file Socket.h. std::string Socket::m_sClientHostname [protected] Definition at line 65 of file Socket.h. The documentation for this class was generated from the following files: Common/Socket.h Common/Socket.cpp Generated on Mon Nov 30 09:54:57 2009 for DataServer by  1.6.1