Partager via


CInternetConnection::CInternetConnection

This member function is called when a CInternetConnection object is created.

CInternetConnection(
   CInternetSession* pSession,
   LPCTSTR pstrServer,
   INTERNET_PORT nPort = INTERNET_INVALID_PORT_NUMBER,
   DWORD_PTR dwContext = 1 
);

Parameters

  • pSession
    A pointer to a CInternetSession object.

  • pstrServer
    A pointer to a string containing the server name.

  • nPort
    The number that identifies the Internet port for this connection.

  • dwContext
    The context identifier for the CInternetConnection object. See Remarks for more information about dwContext.

Remarks

You never call CInternetConnection yourself; instead, call the CInternetSession member function for the type of connection you want to establish:

The default value for dwContext is sent by MFC to the CInternetConnection-derived object from the CInternetSession object that created the InternetConnection-derived object. The default is set to 1; however, you can explicitly assign a specific context identifier in the CInternetSession constructor for the connection. The object and any work it does will be associated with that context ID. The context identifier is returned to CInternetSession::OnStatusCallback to provide status on the object with which it is identified. See the article Internet First Steps: WinInet for more information about the context identifier.

Requirements

Header: afxinet.h

See Also

Concepts

CInternetConnection Class

CInternetConnection Members

Hierarchy Chart

CInternetSession Class

CGopherConnection Class

CFtpConnection Class

CHttpConnection Class