/// /// /// /// import net from "net"; import { EventEmitter } from "stream"; import tls from "tls"; export declare class PopSocket extends EventEmitter { readonly secure: boolean; readonly socket: net.Socket | tls.TLSSocket; /** * Constructs a new PopSocket. * @param secure if the socket is secure. * @param socket the socket. */ constructor(secure: boolean, socket: net.Socket | tls.TLSSocket); /** * Gets the address string. */ get address(): string; /** * Gets the port. */ get port(): number; /** * Gets the socket family. */ get family(): string; /** * COnnects to the given host and port. * @param host the host. * @param port the port. * @param secure if it is secure. * @returns The PopSocket. */ static connect(host: string, port: number, secure: boolean): Promise; /** * Closes the socket. */ close(): void; /** * Pauses. */ pause(): void; /** * Resumes. */ resume(): void; /** * Sets the socket timeout. * @param timeout the timeout. * @returns ourselves. */ set_timeout(timeout: number): PopSocket; /** * Writes the given data to the socket. * @param data the data to write. * @returns All written. */ write(data: string): boolean; /** * Gets called when the socket was closed. * @param had_error if there was an error (net only). */ protected _event_close(had_error: boolean): void; /** * Gets called when there is data available. * @param data the data. */ protected _event_data(data: Buffer): void; /** * Gets called when the write buffer is empty. */ protected _event_drain(): void; /** * Gets called when the other side wants to end. */ protected _event_end(): void; /** * Gets called when an error occured. * @param err the error. */ protected _event_error(err: Error): void; /** * Gets called when an timeout occured. */ protected _event_timeout(): void; /** * Gets called when the socket is connected. */ protected _event_connect(): void; }