Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

How to write a simple but effective TCP/IP port scanner for Win32

, 27 Oct 2001
An article on how to write a TCP/IP port scanner with a GUI, based on the MFC's property sheet paradigm
/*
	TcpConnectPage.h
	Luca Piergentili, 14/07/99
	lpiergentili@yahoo.com
	http://www.geocities.com/lpiergentili/
*/
#ifndef _TCPCONNECTPAGE_H
#define _TCPCONNECTPAGE_H 1

#include "window.h"
#include "CAsyncSock.h"
#include "CPropertyPageDialog.h"
#include "TcpScanConfig.h"

class CConnectPage : public CPropertyPageDialog
{
	DECLARE_DYNCREATE(CConnectPage)

public:
	CConnectPage();
	~CConnectPage();

	// gestori
	void		DoDataExchange			(CDataExchange*);	// scambio dati
	BOOL		OnInitDialog			(void);			// inizializzazione dialogo (pagina)
	BOOL		OnSetActive			(void);			// attivazione pagina
	BOOL		OnKillActive			(void);			// disattivazione pagina
	void		OnKillSheet			(void);			// chiusura sheet
	void		OnOk					(void);			// click su IDOK dello sheet
	void		OnCancel				(void);			// click su IDCANCEL dello sheet

	// membri
	void		GetPropertySheetConfig	(CTcpScanConfig* pConfig) {m_pConfig = pConfig;}
	
	// variabili
	CString	m_strConnectHostAddr;
	UINT		m_nConnectHostPort;
	CString	m_strHostSend;
	CString	m_strHostRecv;

private:
	// gestori
	void		OnKillFocusComboHost	(void);			// IDC_COMBO_HOST
	void		OnKillFocusComboPort	(void);			// IDC_COMBO_PORT

	// connessione
	LONG		OnConnect				(UINT,LONG);		// messaggi inviati dal socket
	LONG		OnRead				(UINT,LONG);
	LONG		OnWrite				(UINT,LONG);
	LONG		OnClose				(UINT,LONG);

	// variabili
	char*			m_pConnectButtonText;			// testo per il bottone IDOK dello sheet
	char*			m_pSendButtonText;				// testo per il bottone IDOK dello sheet
	char*			m_pCancelButtonText;			// testo per il bottone IDCANCEL dello sheet
	int				m_nMaxHostAddr;				// numero max di host per il combo
	int				m_nMaxPortNumber;				// numero max di porte per il combo
	CComboBox			m_wndComboHost;				// combo per il nome host
	CComboBox			m_wndComboPort;				// combo per la porta
	CTcpScanConfig*	m_pConfig;					// configurazione
	CAsyncSock*		m_pAsyncSocket;				// socket asincrono

	DECLARE_MESSAGE_MAP()
};

#endif // _TCPCONNECTPAGE_H

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Luca Piergentili
Web Developer
Italy Italy
I like C and C++, Acid Jazz, James Brown, gli Spaghetti Aglio e Olio, alla Bolognesa, alla Puttanesca e le Fettuccine alla Matriciana ('Maccaroni' over the world). Of course I like beautiful big tits girls too, my little car, Frank Zappa, the art of Zen, italian coffee and much more...

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141216.1 | Last Updated 28 Oct 2001
Article Copyright 2001 by Luca Piergentili
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid