Windows Socket Custom Control Reference

Copyright © 1995 Fenestra Software L.L.C.

Properties	Events	Licence	Errors	Support
Description

This control provides communications for your application by allowing the transmission and reception of data through the winsock dynamic link library.

File Name

FSSOCKET.VBX

Object Type

FSSocket

Remarks

The FSSocket control has two methods for establishing a connection via winsock.

 Client mode. Your application sets the PortNumber and HostAddress it wishes to communicate with, and then uses the Connect property to establish the connection.

 Server mode. Your application sets the port it wants to Listen on for a connection. The control will notify the application when a client has made a connection.

Each FSSocket control can communicate only over one connection. If you need more than one connection you must use more than one control.

Distribution Note When you create and distribute applications that use the FSSocket control, you should install the file FSSOCKET.VBX in the customer's Microsoft Windows \SYSTEM subdirectory. The Setup Kit included with Visual Basic provides tools to help you write setup programs that install your applications correctly.


Properties

About	Connect	EOL	HostAddress	HostName
InputBufferSize	ListenPort	Listen	ListenSocket	LocalAddress
LocalName	OutputBufferSize	PortNumber	Protocol	Send
ServiceName	Socket	WSALastErrorMsg	WSALastError


Events

Connected	DataReceived	Disconnected	ReadyToSend


Connected

Description

The Connected event is generated when a successful connection has been made.

Visual Basic

Sub FSSocket_Connected (StatusCode As Integer, Description As String)

Remarks

The StatusCode contains 0 and the Description contains "OK".

This event is not generated for client type UDP connections.  UDP connections are "send and pray".


DataReceived
DataReceived Event

Description

This event is generated when data has been received over the connection.

Visual Basic

Sub FSSocket_DataReceived (Text As String, EOL As Integer)

Remarks

The Text contains the data that was received. EOL is True if the EOL property has been set and a matching string was found in the data received. The matching EOL string is stripped from the Text. Any data that remains after the EOL string will be included in the next DataReceived event.


Disconnected
Disconnected Event

Description

The Disconnected event is generated when a connection closes.

Visual Basic

Sub  FSSocket_Disconnected (StatusCode As Integer, Description As String)

Remarks

The StatusCode  and Description contain the reason for the disconnect.


ReadyToSend
ReadyToSend Event

Description

The ReadyToSend event is generated when the backlog of data to send reaches 0.

Visual Basic

Sub FSSocket_ReadyToSend ()

Remarks

If a Send fails with a WSALastErrorMsg of "Operation Would Block", your application can wait for this event before retrying the Send


About
About Property

Description

Contains Copyright information


Connect
Connect Property

Description

Set to True to establish a connection.

Remarks

This is an action property. When your application sets this property to True the control attempts to create a connection to the PortNumber and HostAddress specified. If the connect is successful the Connected event occurs, otherwise this property is set to False.

If the Protocol property is set to UDP, this sets the default address for all sends and receives to the HostAddress and PortNumber.

This property is also set to True when the control is in server mode and a connection is established.


EOL
EOL Property

Description

Contains a string that delimits lines of input received.

Remarks

When receiving ASCII data it is often useful to break the data up into individual lines. This property allow you to specify a string that marks the end of line for incoming data. The receiving buffer is searched for a matching string. When it is found, the data, up to but not including the end of line string, is sent to your application via the DataReceived event. Any remaining data in the buffer is sent to your application in the next DataReceived event.


HostAddress
HostAddress Property

Description

Contains the Internet Address of the host your application is attempting to communicate with.

Remarks

The format of the property is the standard Internet dot format.

Setting this property causes the control to issue a blocking gethostbyaddr call to fill in the HostName property.


HostName
HostName Property

Description

Contains the Internet Domain Name of the host your application is attempting to communicate with.

Remarks

The format of the property is the standard Internet dot format.

Setting this property causes the control to issue a blocking gethostbyname call to fill in the HostAddress property.


InputBufferSize
InputBufferSize Property

Description

Specifies the size of the input buffer.

Remarks

This specifies the size of the buffer FSSocket uses to hold the incoming data prior to generating the DataReceived event and the size of the underlying Window Socket input buffer.


Listen Property

Description

Set to True to establish a server application.

Remarks

This is an action property. Setting this property to True puts the control into server mode. The control will then listen on the specified port for a client connection.  When a connection is made a Connected event occurs. At this time your application can examine the HostAddress property to establish the address of the client. While a client/server connection is open any other attempt by a client to open a connection will be queued until the current connection is closed.

When your application sets this property to True the control attempts to listen on the ListenPort specified.

If the ListenPort is zero, Sockets will select a port for you and the port number will be placed in ListenPort.

If the Protocol property is set to UDP, nothing happens. If you really need a UDP server, you should contact Fenestra Software and let us try to talk you out of it.


ListenPort Property

Description

Specifies the port that your application wishes to monitor for incoming connections.

Remarks

Setting this property to zero causes Sockets to select a port number when the Listen property is set to True.


LocalAddress
LocalAddress Property

Description

Contains the Internet Address of the system this control is running on.

Remarks

This property is read only.


LocalName
LocalName Property

Description

Contains the Domain Name of the system this control is running on.

Remarks

This property is read only.


OutputBufferSize
OutputBufferSize Property

Description

Specifies the size of the output buffer.

Remarks

This specifies the size of the buffer FSSocket uses to hold the outgoing data while waiting for a FD_WRITE message from Windows Sockets and the size of the underlying Window Socket output buffer.


PortNumber
PortNumber Property

Description

Specifies the number of the port your application is attempting to communicate with.

Remarks

Setting this value also sets the ServiceName property.


Protocol
Protocol Property

Description

Specifies the protocol to use for this connection.

Remarks

Currently only TCP and UDP are supported.

Connected events are not generated when using UDP for a client connections.


Send
Send Property

Description

Send data over the connection.

Remarks

Assigning a string to this property sends the string over the connection.


ServiceName
ServiceName Property

Description

Contains a string representing the service you wish to communicate with.

Remarks

Setting this value also sets the PortNumber property.


WSALastError
WSALastError Property

Description

Contains the last error number returned by Windows Sockets.

Remarks

When FSSocket detects an error from Windows Sockets, the error number is placed in this property and a trappable FSSocket error is generated.


WSALastErrorMsg
WSALastErrorMsg Property

Description

Contains a string corresponding to the WSALastError property.

Remarks

When FSSocket detects an error from Windows Sockets, an error message is placed in this property and a trappable FSSocket error is generated.


Licence
Copyright/License/Warranty

FSSocket Copyright © 1995 by FENESTRA SOFTWARE L.L.C..

All rights reserved.

License Agreement

You should carefully read the following terms and conditions before using this software.  Unless you have a different license agreement signed by Fenestra Software, your use of this software indicates your acceptance of this license agreement and warranty.

Evaluation and Registration

This is not free software.  You are hereby licensed to use this software for evaluation purposes without charge for a period of 60 days.  If you use this software after the 60 day evaluation period a registration fee as shown in the section Ordering Information/Order Form is required.  Payments must be in US dollars drawn on a US bank, and should be sent to:

Fenestra Software
3320 West Taro Lane
Phoenix AZ 85027-6157

When payment is received you will be sent a registered copy of the latest version of FSSocket.

Unregistered use of FSSocket after the 60-day evaluation period is in violation of U.S. and international copyright laws.

Distribution

Provided that you verify that you are distributing the Shareware Version (double click on the "About" property) you are hereby licensed to make as many copies of the Shareware Version of this software and documentation as you wish; give exact copies of the original Shareware Version to anyone; and distribute the Shareware Version of the software and documentation in its unmodified form via electronic means.  There is no charge for any of the above.

You are specifically prohibited from charging, or requesting donations, for any such copies, however made; and from distributing the software and/or documentation with other products (commercial or otherwise) without prior written permission, with one exception:

Disk Vendors approved by the Association of Evaluation Professionals are permitted to redistribute FSSocket, subject to the conditions in this license, without specific written permission.

No one, other that Fenestra Software L.L.C. or its designated representative, may distribute the license file.

Registered Version

One registered copy of FSSocket may either be used by a single person who uses the software personally on one or more computers, or installed on a single workstation used nonsimultaneously by multiple people, but not both.

You may access the registered version of FSSocket through a network, provided that you have obtained individual licenses for the software covering all workstations that will access the software through the network.  For instance, if 8 different workstations will access FSSocket on the network, each workstation must have its own FSSocket license, regardless of whether they use FSSocket at different times or concurrently.

You may not place the license file on more that one system, or access the license file over a network.

You may not distribute the license file.

You may transfer the license file on a permanent basis provide you retain no copies.

Disclaimer of Warranty

THIS SOFTWARE AND THE ACCOMPANYING FILES ARE SOLD "AS IS" AND WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED.  Because of the various hardware and software environments into which FSSocket may be put, NO WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE IS OFFERED.

Good data processing procedure dictates that any program be thoroughly tested with non-critical data before relying on it.  The user must assume the entire risk of using the program.  ANY LIABILITY OF THE SELLER WILL BE LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT OR REFUND OF PURCHASE PRICE.


Error Codes

The following trappable errors can be generated by the FSSocket control.

Error Number	Explanation
20101	Unable to obtain memory.
20102	WinSocket Error detected
The following is a list of possible error codes returned in the WSALastError property, along with their explanations.  The error numbers are consistently set across all Windows Sockets compliant implementations.

WSALastError	WSALastErrorMsg
10004	Interrupted system call.
10009	Bad file number.
10013	Access denied.
10014	Bad address.
10022	Invalid argument.
10024	Too many open files.
10035	Operation would block.
10036	Operation now in progress.
10037	Operation already in progress.
10038	Socket operation on non-socket
10039	Destination address required.
10040	Message too long.
10041	Protocol is wrong type for socket.
10042	Bad protocol option.
10043	Protocol not supported.
10044	Socket type not supported.
10045	Operation not supported on socket.
10046	Protocol family not supported.
10047	Address family not supported by protocol family
10048	Address already in use.
10049	Cant assign requested address.
10050	Network is down.
10051	ICMP network unreachable.
10052	Network was reset.
10053	Software caused connection abort.
10054	Connection reset by peer.
10055	No buffer space is supported.
10056	Socket is already connected.
10057	Socket is not connected.
10058	Cant send after socket shutdown
10059	Too many references.
10060	Connection timed out.
10061	Connection refused.
10062	Too many levels of symbolic links.
10063	Name too long.
10064	Host is down.
10065	Host is unreachable.
10066	Directory not empty.
10067	EPROCLIM returned.
10068	EUSERS returned.
10069	Disk quota exceeded.
10070	ESTALE returned.
10071	The object is remote.
10091	System not ready.
10092	Version is not supported.
10093	Not initialized.
10101	The circuit has gracefully terminated
11001	Host not found.
11002	Try again.
11003	Non recoverable error.
11004	No data record available.


Ordering Information/Order Form

FSSocket 1.0 Order Form/Invoice

Ordering by check:  To order by check send this order form and a check to:

Fenestra Software L.L.C.
3320 West Taro Lane
Phoenix AZ 85027-6157

To print this order form, click on Print Topic in the File pull-down menu. Payments must be in US dollars drawn on a US bank, or you can send international postal money orders in US dollars.

Credit card ordering:  Credit card ordering was not available at the time this form was prepared.

CompuServe Registration:  To have the registration fee added to your CompuServe bill type GO SWREG at the ! prompt and follow the menus.

Prices include shipping by postal mail (airmail outside USA).

Prices guaranteed through June, 1995.

Multiple copy discounts are available. Contact Fenestra Software for current pricing.

FSSocket Single Copy  _______ copies at $75 each = ______

Arizona residents add 8% sales tax               + ______

                         Total payment             ______

Name: ________________________________Date:______________

Company: ________________________________________________

Address: ________________________________________________

City, State, Zip: _______________________________________

Country: ________________________________________________

Day Phone: ____________________Eve:______________________

Electronic Mail address: ________________________________

How did you hear about FSSocket? ________________________

Comments:


Support
Support and Questions

Technical support is available at no charge by sending electronic mail to to

jcs@primenet.com on the Internet,

or by sending US Mail to

Fenestra Software L.L.C.
3320 West Taro Lane
Phoenix AZ 85027-6157


Socket

Description

Contains the Socket number for this control.

Remarks

This property is read only.


ListenSocket

Description

Contains the Socket number this control is watching for connections.

Remarks

This property is read only.