Click here to Skip to main content
15,885,366 members
Articles / Desktop Programming / MFC

Peer-to-Peer Communicator and File Transfer

Rate me:
Please Sign up or sign in to vote.
4.33/5 (57 votes)
14 Aug 20013 min read 390.3K   21.9K   167  
Get youself a peer-to-peer communicator and exchange files across a network.
// NetIPAddress.h: interface for the CNetIPAddress class.
//
// Written by Marat Bedretdinov (maratb@hotmail.com)
// Copyright (c) 2000.
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is 
// not sold for profit without the authors written consent, and 
// providing that this notice and the authors name is included. 
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability if it causes any damage whatsoever.
// It's free - so you get what you pay for.//

#if !defined(AFX_NETIPADDRESS_H__B4C555D7_EBC4_42FB_98D2_34A3D895BF42__INCLUDED_)
#define AFX_NETIPADDRESS_H__B4C555D7_EBC4_42FB_98D2_34A3D895BF42__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "NetAddress.h"
#include "NetSockConnector.h"

class CNetIPAddress : public CNetAddress  
{
public:
                                         CNetIPAddress();
        virtual                          ~CNetIPAddress();

        virtual       CNetConnection*    CreateConnector() const 
											{ return new CNetSockConnector; }

        virtual 	     CNetAddress* 	 Clone() const; 

                                void     SetConnectString(sockaddr* sockAddr);

        virtual                 void     SetConnectString(const char* szAddr);

					static	  string	 MakeLocalHostAddr(const char*);

                                void     GetLocalHostAddr(sockaddr_in&) const;
							  string     GetLocalHostName() const;

                          const char*    GetHostName() const;
                                 int     GetPortNumber() const;
 
                                void     GetRemoteHostAddr(sockaddr_in&) const;

                                bool     IsEmpty() const;
protected:
                                void     HandleException(int nNetErr, const char* strSrc) const;
};


#endif // !defined(AFX_NETIPADDRESS_H__B4C555D7_EBC4_42FB_98D2_34A3D895BF42__INCLUDED_)

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



Comments and Discussions