Name - The name of the machine. This will be empty if the address has no name.
AliasList - This contains the alternate names for the IP address. Some machines have multiple names.
void Close( void )
void GetAddress( CString& dotted_ip_address_string ) const
SOCKET GetID( void ) const
void GetMyAddress( CString& dotted_ip_address_string )
void GetMyName( CString& machine_name )
void GetName( CString& host_name ) const
DWORD GetOptions( void ) const
void GetPort( short& port_number ) const void GetPort( CString& port_name ) const
port_number and "telnet"
in port_name. If no name can be found for the port number,
port_name will be filled with a string representation of
the port number.
TCHAR GetStringReadTerminatorCharacter( void ) const
BOOL IsBroken( void ) const
BOOL IsDataWaiting( void )
BOOL Open( void ) = 0 BOOL Open( LPCTSTR machine_name_or_address, UINT port_number = 23, CFileException * = NULL ) = 0
void Read( CString& line_to_read ) UINT Read( VOID * buffer, UINT maximum_number_of_bytes_to_read )
void SetAddress( LPCTSTR address )
void SetID( const SOCKET socket_id )
socket_id
is attached.
void SetName( LPCTSTR machine_name )
void SetOptions( DWORD options )
optionsDefault - Does nothing.
optionsDontResolveHostName - When this option is set and
Open() is called with an IP address, it will not
be resolved to a machine name.
optionsDontResolvePortNumber - When this option is set and
SetPort() is called with a port number, it will not
be resolved to a port name.
void SetPort( const short port_number ) void SetPort( const char * port_name )
void SetReadTimeout( DWORD number_of_milliseconds )
void SetStringReadTerminatorCharacter( TCHAR character )
void SetWriteTimeout( DWORD number_of_milliseconds )
void StartWindowsSockets( void )
void StopWindowsSockets( void )
void TranslateErrorCode( DWORD error_code, LPSTR destination_string, DWORD size_of_string )
BOOL Transmit( CFile& file_to_send, DWORD flags = TF_DISCONNECT, CByteArray * send_before = NULL, CByteArray * send_after )
file_to_send down the socket. If you want to
send some bytes before the file, set send_before to the address
of a CByteArray. If you want some bytes sent after the file, set send_after
to the address of a CByteArray. Read up on the TransmitFile() API for a
discussion of the flags parameter.
void Write( const CString& string_to_write ) void Write( const VOID * buffer, const long number_of_bytes_to_write )
#include <wfc.h>
#pragma hdrstop
int close_the_socket( CSimpleSocket& the_socket )
{
WFCTRACEINIT( TEXT( "close_the_socket()" ) );
DWORD socket_options = the_socket.GetOptions();
if ( socket_options & optionsDontResolveHostName )
{
WFCTRACE( TEXT( "Host name was not resolved." ) );
}
if ( socket_options & optionsDontResolvePortNumber )
{
WFCTRACE( TEXT( "Port number was not resolved." ) );
}
the_socket.Close();
// OK, this is a really lame sample but the class
// is pure virtual!
}