Click here to Skip to main content
15,886,074 members
Articles / Web Development / HTML

Asynchronous TCP Part 2

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
29 Mar 2013CPOL9 min read 41.2K   2.9K   30  
Goal: Describe how asynchronous or non-blocking TCP code works
#pragma once
#include "afxsock.h"
#include "Constants.h"

class C_MFC_Winsock_01_Dlg;

class C_Client :
	public CAsyncSocket
{
public:
	C_Client(void);
	~C_Client(void);

   void Set_Parent_Pointer( C_MFC_Winsock_01_Dlg *new_pointer );

	int  Class_Get_WSA_Error_Code();
	bool Class_Initialize();
	bool Class_Connect();
	bool Class_Close();
   bool Class_Receive();
   SYSTEMTIME Class_Get_Time();


	virtual void OnAccept(int nErrorCode);
	virtual void OnClose(int nErrorCode);
	virtual void OnConnect(int nErrorCode);
	virtual void OnOutOfBandData(int nErrorCode);
	virtual void OnReceive(int nErrorCode);
	virtual void OnSend(int nErrorCode);

private:

	TCHAR m_ip_address[ MAX_IP_ADDRESS_LENGTH ];
	UINT m_port_number;
	int  m_wsa_error;
   BOOL m_winsock_status;
   bool m_method_status;

   C_MFC_Winsock_01_Dlg *mp_main_dialog;
   SYSTEMTIME m_current_time;


   unsigned int m_client_on_accept_count;
   unsigned int m_client_on_close_count;
   unsigned int m_client_on_connect_count;
   unsigned int m_client_on_out_of_band_count;
   unsigned int m_client_on_receive_count;
   unsigned int m_client_on_send_count;

};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions