get host ip address.

This commit is contained in:
TAO Cheng
2014-10-29 21:05:58 +08:00
parent 02f1c7e503
commit 32f9acc866
7 changed files with 283 additions and 71 deletions
@@ -1,5 +1,3 @@
// protocol for control SevenOcean's Machine
//
//////////////////////////////////////////////////////////////////////
#ifndef SO7_TCPIP_H_INCLUDED_
#define SO7_TCPIP_H_INCLUDED_
@@ -31,18 +29,35 @@ public:
CSo7_TCPIP();
virtual ~CSo7_TCPIP();
TCPIP_RETURN_CODE Connect();
TCPIP_RETURN_CODE Send();
TCPIP_RETURN_CODE Recv();
TCPIP_RETURN_CODE Connect(const HWND& _hWnd,const in_addr& _IPAddress,const u_short& _nPortNumber);
TCPIP_RETURN_CODE Send(int _Addr,int _Data);
TCPIP_RETURN_CODE Recv(int _Addr,int& _Data,bool _bWait);
TCPIP_RETURN_CODE DisConnect();
HWND m_hMsgWnd;
TCPIP_RETURN_CODE GetHostIPAddr(in_addr& _IPAddress);
LRESULT OnSocket(WPARAM wParam, LPARAM lParam);
private:
SOCKET m_socket;
LPCSTR m_pszNetworkAddr;
u_short m_nPortNumber;
bool m_bDisableTimeout;
int Init_Winsock();
HWND m_hMsgWnd;
char *m_ReceiveBuf;
char *m_SendBuf;
double *m_dReceiveDBuf;
int m_iReceiveDBufSize;
int m_iBytesToReceive,m_iBytesReceived;
int m_iBytesToSend,m_iBytesSent;
static int m_iReceiveMaxBufSize;
static int m_iSendMaxBufSize;
static SOCKET m_Socket;
static in_addr m_SreverIPAddress;
static u_short m_iServerPortNumber;
void clearSendBuf();
int Init_Winsock();
void m_ProcessSocketWriteEvent();
void m_ProcessSocketReadEvent(SOCKET s);
};
#endif