OstroSoft Winsock Component

Winsock object
non-blocking Windows socket
Methods:
object.Accept(requestID As Long)
Accept an incoming connection request
object.Bind([LocalPort], [LocalIP])
Binds socket to specific port and adapter
object.CloseWinsock()
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)
object.GetDataBuffer()
Returns data sent by the remote computer (For use in JavaScript and similar languages, not supporting return parameters in functions)
object.Listen()
Listen for incoming connection requests
object.PeekData(data, [vtype], [maxLen])
Look at incoming data without removing it from the buffer
object.SendData(data)
Send data to remote computer
Properties:
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:
valuenamedescription
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:
valuenamedescription
0sckClosedconnection closed
1sckOpenopen
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
Connect
Data Arrival
Send Progress
Send Complete
Close
Error <error-number>: <error-description>

object.Tag As String
Stores any extra data needed for your program
Events:
object.OnClose()
connection closed
object.OnConnect()
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
object.OnSendComplete()
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
Properties:
object.Connected As Boolean
Connection status (True, if connected)
Methods:
object.Connect(Host As String, Port As Long)
Connect to remote host
object.Disconnect()
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)