Events
Closing()
Description: Triggered when socket is about to close but has not yet been fully closed.
Connect()
Description: Triggered upon successful connection. Data may now be sent.
ConnectionRequest(RequestID)
Description: Triggered when a remote host is connecting to a listened port.
DataArrival(BytesTotal)
Description: Triggered when data has arrived in binary mode.
Error(Number, Description, sCode, Source, HelpFile, HelpContext, CancelDisplay)
Description: Triggered whenever an internal error occurs.
NOTE: Unlike Winsock control, an error does not prevent operation and you are not required to close the connection.
SendComplete()
Description: Triggered when sending data has finished.
SendProgress(BytesSent, BytesRemaining)
Description: Triggered as sending data progresses.
StatusChange(Status)
Description: Triggered when status changes. However, error status is not received in favor of Error event.
TextArrival(Text, LineChange, ANSI)
Description: Triggered when a line of data has arrived. If text is Unicode, Text can be used directly. If text is ANSI, you must use StrConv or other means to process the text into an usable string.
Methods
Accept(RequestID) Boolean
Description: Accepts a connection request from another UniSock control. The socket must be in a closed state before using this function. Upon successful accept Connect event is fired.
Result: Returns True if the RequestID was valid.
Bind([LocalPort], [LocalIP]) Boolean
Description: Binds socket to currently set local port and ip. These may also be given as parameters. LocalIP can be an IP or a hostname.
Result: Returns True if the IP and port were binded successfully.
CloseSocket() Boolean
Description: Cancels all asynchronous activity and closes the socket.
Result: Returns True if the socket was closed.
Connect([RemoteHost], [RemotePort]) Boolean
Description: If protocol is TCP, begins connection to currently set remote host and port, or given host and/or port. If protocol is UDP, the current local ip and port are bind.
Result: Returns True if the connection could be initialized (TCP) or True if the local ip and port could be bind (UDP).
GetData(Data, [VarType], [MaxLen]) Boolean
Description: Gets current incoming buffer to variable passed to Data. If passed variable is a variant, variable type set into optional VarType will be used. The default datatype is byte array. MaxLen sets the amount of bytes to retrieve. Whole buffer is retrieved if MaxLen is 0 or less, or greater than the buffer size.
Unlike other Winsock control/class implementations, you may use all numeric datatypes and string: Boolean, Byte, Currency, Date, Double, Integer, Long, Single and String. All supported datatypes can be also be passed as arrays. String array separator is automatically detected (CRLF, LF, CR or NullChar). Strings are coerced from ANSI.
Result: Returns True if the buffer was retrieved.
Listen() Boolean
Description: Binds currently set local ip and port if not bind already and starts listening for incoming connections. Upon connection ConnectionRequest event is fired.
Result: Returns True if binding and initializing listening was successful.
PeekData(Data, [VarType], [MaxLen]) Boolean
Description: Identical to GetData, except the data is not removed from the buffer.
SendData(Data) Boolean
Description: Sends the given data to remote host. See GetData for supported datatypes. Strings are coerced to ANSI.
Result: Returns True if inserting data to output buffer was successful.
SendText(Text, [TextFormat]) Boolean
Description: Sends a single line of string data. A line change character determined by LineChange is added to the string. TextFormat determines whether text is converted to UTF-8 or sent as is.
Result: Returns True if inserting data to output buffer was successful.
Properties
BytesReceived() Long
Result: Returns the current size of the incoming data buffer.
LineChange() UniSockLineChange
Description: Returns/sets the bytes that determine line change or array separator. This value is used when sending string arrays and when using SendText.
LocalHostname() String
Description: Returns the current hostname.
LocalIP() String
Description: Returns the current local ip.
LocalPort() Long
Description: Returns/sets the current local port.
Mode() UniSockMode
Description: Returns/sets the mode of the socket. Binary and text modes are supported. In binary mode DataArrival event is triggered. In text mode TextArrival event is triggered.
Protocol() ProtocolConstants
Description: Returns/sets the current protocol. TCP and UDP are supported.
RemoteHost() String
Description: Returns/sets the host to connect to, or returns the host that has been connected to.
RemoteHostIP() String
Description: Returns the remote host IP address as a string.
RemoteIP() Long
Description: Returns the remote host IP address as a 32-bit value.
RemotePort() Long
Description: Returns/sets the remote port to connect to, or port that has been connected to.
RequestHost() String
RequestIP() String
RequestPort() Long
Description: Information available about the remote host that makes a connection request to a listening socket. Use before accepting a connection to determinte whether you wish to accept the request.
SocketHandle() Long
Result: Returns the current open socket handle, or -1.
State() StateConstants
Result: Returns the current connection state of the control.
No tiene los permisos requeridos para ver los archivos adjuntos a este mensaje.