Logo
English Russian German French Spanish Italian
contact usprivacy
   Support Forums
chart
• About the product
• Download
• Sample projects:
Using with Visual Basic
Using with VB.NET
Using with C#
Using with ASP
Using with ASP.NET
Using with Office (VBA)
Using with VBScript
Using with JavaScript
Using with SQL Server
• Support Forum
OISV - Organization of Independent Software Vendors - Contributing Member
OstroSoft Winsock Component (OSWINSCK.dll)

• Description   • Installation   • Licensing   • Comparison with MS Winsock   • Object Reference

Description

OSWINSCK.dll is a COM library for Visual Basic 6, providing an easy access to the network layer of operating system (UDP and TCP sockets). OSWINSCK.dll serves as a wrapper for Winsock API and helps programmers to abstract from complexity of API calls and concentrate on application functionality.

By using OSWINSCK.dll you agree to terms of License Agreement

Installation

for use with Visual Basic 6 (any edition):
1. download oswinsck.zip
2. from downloaded file unzip OSWINSCK.dll to Windows System directory
3. run "regsvr32 OSWINSCK.dll" from command-line

for use with .NET, Visual Basic 4 or 5, Visual C++, ASP, VBA, VBScript, JavaScript or any other language, supporting COM:
1. download oswinsck.exe
2. run downloaded file from Windows Explorer or command-line

Licensing

Non-commercial licensefree
Unlimited usage for developing non-commercial applications.
Developer license$19.00(purchase)
For a single programmer to develop and distribute a single commercial application.
Server license$59.00(purchase)
For use in a commercial application, installed on a single server.
Enterprise license$139.00(purchase)
For programmers within a company to develop and distribute an unlimited number of commercial applications.

Comparison with MS Winsock
 OstroSoft Winsock ComponentMicrosoft Winsock Control
LicensingCan be used in any version of Visual Basic and in any language, supporting COMCan be used only in Visual Basic Professional or Enterprise edition
DistributionRequires only oswinsck.dll and VB runtimesSubject to license restrictions above
UsageDoesn't require visual interface, can be used in class modulesRequires form module
ScriptingProvides blocking calls for scriptingDoesn't support scripting


Object reference
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)

Copyright © 1996-2010 OstroSoft. All rights reserved. info@ostrosoft.com