| The Internet Server control provides an interface which is similar
        to the SocketWrench control, but is specifically designed to simplify
        the development of a server application. The control provides a
        collection of methods which can be used to easily create an
        event-driven server application. The server runs on a separate thread
        in the background, automatically managing the individual client
        sessions as servers connect and disconnect from the server. Events
        are used to notify the application when the client establishes a
        connection with the server, sends data to the server or disconnects.
        Methods such as Read and Write are used to exchange data with the
        clients. It is important to note that although the server is multithreaded,
        the ActiveX control specification requires that event notifications be
        marshaled across threads. This means that the event handler code that
        is written executes in the context of the thread that created the
        control, typically the main UI thread. For languages such as Visual
        Basic 6.0, the Internet Server control can be used to easily create a
        server which is designed for a limited number of active client
        connections. However, for higher volume servers it is recommended that
        you use a language that fully supports multithreading. The following properties, methods and events are available for use
        by your application: 
          
          Initialize
          Initialize the control and validate the runtime license key for the
          current process. This method is normally not used if the control is
          placed on a form in languages such as Visual Basic. However, if the
          control is being created dynamically using a function similar to
          CreateObject, then the application must call this method to
          initialize the component before setting any properties or calling any
          other methods in the control.
 Start
          This method starts the server, creating the background thread and
          listening for incoming client connections on the specified port
          number. You can specify the local address, port number, backlog queue
          size and the maximum number of clients that can establish a
          connection with the server.
 Restart
          This method will terminate all active client connections, close the
          listening socket and re-create a new listening socket bound to the
          same address and port number.
 Suspend
          This method instructs the server to temporarily suspend accepting new
          client connections. Existing connections are unaffected, and any
          incoming client connections are queued until the server is resumed.
          It is not recommended that you leave a server in a suspended state
          for an extended period of time. Once the connection backlog queue has
          filled, any subsequent client connections will be automatically
          rejected.
 Resume
          This function instructs the server to resume accepting client
          connections after it was suspended. Any pending client connections
          are accepted after the server has resumed normal operation.
 Throttle
          This method is used to control the maximum number of clients that may
          connect to the server, the maximum number of clients that can connect
          from a single IP address and the rate at which the server will accept
          client connections. By default, there are no limits on the number of
          active client sessions and connections are accepted immediately. This
          method can be useful in preventing denial-of-service attacks where
          the the attacker attempts to flood the server with connection
          attempts.
 Stop
          This method will terminate all active client connections, close the
          listening socket and terminate the background thread that manages the
          server. Any incoming client connections will be refused, and all
          resources allocated for the server will be released.
 
          Uninitialize
          Unload the Windows Sockets library and release any resources that
          have been allocated for the current process. This is the last method
          call that the application should make prior to terminating. This is
          only necessary if the application has previously called the
          Initialize method.
 Input and Output
        When the client establishes a connection with the server, data
        is sent and received as a stream of bytes. The following methods can be
        used to send and receive data over the socket:
 
          Read
          This method reads data from the client and copy it to the string
          buffer or byte array provided by the caller. If the client closes its
          connection, this method will return zero after all the data has been
          read. If the method is successful, it will return the actual number
          of bytes read. This method should always be used when reading binary
          data from the client into a byte array.
 ReadLine
          Read a line of text from the client, up to an end-of-line character
          sequence or when the client closes the connection. This method is
          useful when the client and server are exchanging textual data, as is
          common with most command/response application protocols.
 Write
          This method sends data to the client. If the method succeeds, the
          return value is the number of bytes actually written. This method
          should always be used when sending binary data to the client.
 WriteLine
          Write a line of text to the socket, terminating it with an
          end-of-line character sequence. This method is useful when the client
          and server are exchanging textual data, as is common with most
          command/response application protocols.
 Broadcast
          Broadcasts data to each of the clients that are connected to the
          server. This can be useful when the application needs to send the
          same data to each active client session, such as broadcasting a
          shutdown message when the server is about to be terminated.
 
          IsReadable
          This property is used to determine if there is data available to be
          read from the client. If the property returns a value of True, the
          Read method will return without causing the application to block. If
          the property returns False, there is no data available to read from
          the current client session.
 
          IsWritable
          This property is used to determine if data can be sent to the client.
          In most cases this will return True, unless the internal socket
          buffers are full.
 Local Host Information
        Several properties are provided to return information about
        the local host, including its fully qualified domain name and the IP
        addresses that are configured on the system.
 
          
          ServerName
          Return the fully qualified domain name of the local host, if it has
          been configured. If the system has not been configured with a domain
          name, then the machine name is returned instead.
 
          ExternalAddress
          Return the IP address assigned to the router that connects the local
          host to the Internet. This is typically used by an application
          executing on a system in a local network that uses a router which
          performs Network Address Translation (NAT).
 
          AdapterAddress
          This property array returns the IP addresses that are associated with
          the local network or remote dial-up network adapters configured on
          the system. The AdapterCount property can be used to determine the
          number of adapters that are available.
 |