OstroSoft Winsock Component

Winsock object
non-blocking Windows socket
object.Accept(requestID As Long)
Accept an incoming connection request
object.Bind([LocalPort], [LocalIP])
Binds socket to specific port and adapter
Close current connection
object.Connect([RemoteHost], [RemotePort])
Connect to the remote computer
object.GetData(data, [vtype], [maxLen])
Retrieve data sent by the remote computer (acceptable values for vtype parameter are vbByte, vbInteger, vbLong, vbSingle, vbDouble, vbCurrency, vbDate, vbBoolean, vbError, vbString, vbArray + vbByte)
Returns data sent by the remote computer (For use in JavaScript and similar languages, not supporting return parameters in functions)
Listen for incoming connection requests
object.PeekData(data, [vtype], [maxLen])
Look at incoming data without removing it from the buffer
Send data to remote computer
object.BytesReceived As Long
Returns the number of bytes received on this connection
object.LocalHostName As String
Returns the local machine name
object.LocalIP As String
Returns the local machine IP address
object.LocalPort As Long
Returns/Sets the port used on the local computer
object.Protocol As ProtocolConstants
Returns/Sets the socket protocol. The following protocol type constants are defined:
0sckTCPProtocolTCP Protocol
1sckUDPProtocolUDP Protocol
object.RemoteHost As String
Returns/Sets the name used to identify the remote computer
object.RemoteHostIP As String
Returns the remote host IP address
object.RemotePort As Long
Returns/Sets the port to be connected to on the remote computer
object.SocketHandle As Long
Returns the socket handle
object.State As StateConstants (Long)
Returns the state of the socket connection. The following session state constants are defined:
0sckClosedconnection closed
2sckListeninglistening for incoming connections
3sckConnectionPendingconnection pending
4sckResolvingHostresolving remote host name
5sckHostResolvedremote host name successfully resolved
6sckConnectingconnecting to remote host
7sckConnectedconnected to remote host
8sckClosingconnection is closing
9sckErrorerror occured
object.Status As String
Returns the component status string, one of the following values:

Connection Request
Data Arrival
Send Progress
Send Complete
Error <error-number>: <error-description>

object.Tag As String
Stores any extra data needed for your program
connection closed
connection to remote host established
object.OnConnectionRequest(requestID As Long)
connection request from remote host
object.OnDataArrival(bytesTotal As Long)
new data arrived
object.OnError(Number As Integer, Description As String, Scode As Long, Source As String, HelpFile As String, HelpContext As Long, CancelDisplay As Boolean)
error occured
data send is complete
object.OnSendProgress(bytesSent As Long, bytesRemaining As Long)
data send is in progress
object.OnStatusChanged(ByVal Status As String)
component status changed

TCP object
blocking TCP socket
object.Connected As Boolean
Connection status (True, if connected)
object.Connect(Host As String, Port As Long)
Connect to remote host
Close the connection
object.GetData() As String
Get data from remote host
object.SendData(s As String) As Long
Send data to remote host
object.Sleep(n As Long)
Time delay (in milliseconds)