EsSock ActiveX control

Ake Hedman Brattberg, Gruvbyn 415, S-820 50 LOOS, Sweden (ah@brattberg.se) (http://www.ljusdal.se/esource) RevDate: 96-08-12

This is the first tool from Brattberg in a series of components for easy Internet programming in the Windows environment. The rest of the controls will deal with protocols such as pop, smtp, nntp etc. Possibly we will also implement a ppp/slip control together with a TAPI compliant dialer with script capabilities.

EsSock is a control that handle the client aspect of a Internet socket connection. With this control you can connect to a server over the Internet in either Stream or Datagram mode and send/receive data. The interface to the control has been kept simple so that people can program for the Internet with no or little knowledge of the underlying structures.


Installation

Transfer EsSock32.OCX to your \windows\system or \winnt35\system32 directory and register it by executing the command:

RegSvr32 \Windows\System\EsSock32.OCX

RegSvr32.exe can be found on the Visual Basic 4.0 CD-ROM and in our ftp archive (http://www.ljusdal.se/esource/ftp/misc). If RegSvr32.exe fails, it's probably because you don't have the MFC 4.0 DLL library installed on your system. This is available from many sources on the Internet including our ftp archive as MFC40DLL.ZIP. Regsvr32.exe is also included in this archive. If you want to check if you already got the files in mfc40dll.zip they are


Cookbook or how to use the EsSock Control

The way to work with it

  1. Set type to either Stream (=1) or Datagram (=2). For most of the time you will use stream.
  2. Set the address of the server which you want to connect to. Either use the ip-address or the human form "host.somewhere.com".
  3. Set the Port property for the service you want to connect to.
  4. Use the Connect method. A TRUE response from this method indicated a successful connect.
  5. Use SendString, Send, SendCommand, Read, ReadString to send and receive messages from the host.
  6. Disconnect from the server with the Disconnect method.

 


Properties


String Address

This is the address of the server/host you want to connect to. You can set this value either as an IP-address in the dot notation form as in "127.64.12.1" or in the more human readable form as in "host.somewhere.com".


short ErrorNo

Read only.

When an error is encountered you find a code describing the error here.

Possible errors-codes are:

Symbolic value Description
WSAENETDOWN=10050The Windows Sockets implementation detected that the network subsystem failed.
WSAEADDRINUSE=10048The specified address is already in use.
WSAEINPROGRESS=10036A blocking Windows Sockets call is in progress.
WSAEADDRNOTAVAIL=10049The specified address is not available from the local machine.
WSAEAFNOSUPPORT=10047Addresses in the specified family cannot be used with this socket.
WSAECONNREFUSED=10061The attempt to connect was rejected.
WSAEDESTADDREQ=10039A destination address is required.
WSAEINVAL=10022The socket is not already bound to an address.
WSAEISCONN=10056The socket is already connected.
WSAEMFILE=10024No more file descriptors are available.
WSAENETUNREACH=10051The network cannot be reached from this host at this time.
WSAENOBUFS=10055No buffer space is available. The socket cannot be connected.
WSAENOTSOCK=10038The descriptor is not a socket.
WSAETIMEDOUT=10060Attempt to connect timed out without establishing a connection.
WSAEPROTONOSUPPORT =10043The specified port is not supported.
WSAEPROTOTYPE =10041The specified port is the wrong type for this socket.
WSAENOTCONN =10057The socket is not connected.
WSAEMSGSIZE =10040The datagram was too large to fit into the specified buffer and was truncated.
WSAECONNABORTED=10053The virtual circuit was aborted due to timeout or other failure.
WSAECONNRESET=10054The virtual circuit was reset by the remote side.

Short Port

Portnumber for the service you want to connect to. If you have TCP/IP installed on your computer you will find a file called services in the windows directory that contains many of the port numbers that is defined.


long Timeout

This is a time-out used for certain internal calls in EsSock.


short Type

This is an enumerated property that is capable of holding two values. Stream (=1) or Datagram (=2).


Methods


BOOL Connect()

Use this method to connect to a service on a remote host. Before you use the method you have to set the Address, Port and possibly also the type property.

You use the Disconnect method to close your connection. Note that some protocols such as SMTP also requires a "quit" command.

Returns TRUE if everything OK and you are connected to the remote host's service.


BOOL Disconnect( )

Disconnects from a remote host.

Returns TRUE if everything OK and you are disconnected from the host..


short Read(LPTSTR buf)

With this command you can read input from an open connection into a buffer. This buffer must be capable of holding at least 512 characters. It is your responsibility to allocate this storage before you call the method.

The number of characters read are returned from the method. If this value is set to null this can indicate that there was no characters to read or that an error occurred. If this happens you should always check the ErrorNo for a possible error code.

As most protocols on the Internet work with text we recommend that you use the ReadString method instead of this one.


BSTR ReadString()

With this command you can read input from an open connection into a string. If an error occurs an empty string is returned and the ErrorNo property is set to the error code for the failure.


BOOL Send( LPCTSTR buf, short count )

Use this method to send count characters from a buffer to the host.

TRUE is returned if everything is OK and FALSE if an error occurred. In case of error the ErrorNo property contains the error code.


BSTR SendCommand( LPCTSTR cmd )

This method can be used to send commands to a server and at the same time fetch the response from the server. Before the string 'cmd' is sent to the server a CRLF pair is added to the tail of the string. This is the most usual way for most Internet protocol's to work.

In case of an error an empty string is returned and you should check the property ErrorNo for the error code if this happens. If ErrorNo is set to zero the server just sent back an empty string.


BOOL SendString( LPCTSTR str )

With this method you can send a string to the host.

TRUE is returned if everything went well and FALSE if an error occured. In case of an error the ErrorNo property contains the error code.


Events

There is no events defined for this component.


Where to get the control?

It is possible that you are reading this documentation without having access to the control itself. If you have Internet access you just need to connect to http://www.ljusdal.se/esource and fetch a fully working sample of the control. At this location you can also find samples on how to use the control.

We can email the control anywhere in the world if you send us a request to do so. Please state if you want MIME or BINHEX coding. Send the request to f0002@brattberg.se

This control can also be be found in the ActiveX/OLE Forum on CompuServe (GO OLESOLNS), an official distribution and support online resource for future updates. Search for essock.zip

The Windows Users Group Network [WUGNET], operators of the oldest and largest independent support resource forums for Windows users on CIS with over 1,000,000 active members is recognized in the press, user groups, developers, and Microsoft as the foremost resource for shareware publishers on CompuServe and the Internet.


Register this control & Pricing

When you register the control we will send you the EsSock.lic file which will make the splash screen go away.

If you are entitled to a free registration, (please read our license agreement later in this document to find out if you are) , you have to fill in the form available at http://www.ljusdal.se/esource to receive the EsSock.lic file and get your free license. Note that the free license does not allow you to get support or distribute applications made with the control unless these also are made available free of charge or is used within your nonprofit organization.

If you are not entitled for a free licens you have to pay for the control. This could be done in several ways.


You can register with a credit card.

We work together with PsL on this and here is how you go ahead: Note that this option is for CREDIT CARD ORDERS ONLY.

EsSock has Item Number 14603 at PsL.

You can order with MC, Visa, Amex, or Discover from Public (software) Library by calling (USA) 800-2424-PsL or (USA) 713-524-6394 or by FAX to (USA) 713-524-6398 or by CIS Email to 71355,470 Internet email to 71355,470@compuserv.com.

You can also mail credit card orders to PsL at P.O.Box 35705, Houston, TX 77235-5705, USA.

THE ABOVE NUMBERS ARE FOR CREDIT CARD ORDERS ONLY.
BRATTBERG CANNOT BE REACHED AT THESE NUMBERS.

Any questions about the status of the shipment of the order, refunds, registration options, product details, technical support, volume discounts, dealer pricing, site licenses, non-credit card orders, etc, must be directed to Brattberg, Gruvbyn 415A, S-820 50 LOOS, Sweden Phone: +46 657 10620, Fax: +46 657 105 13 email: f0002@brattberg.se or by use of on-line facilities at http://www.ljusdal.se/esource.

To insure that you get the latest version, PsL will notify us the day of your order and we will ship the EsSock directly to you. If you take the option of email-shipping you will usually have the licensed control the same day.

You can also make this registration online via you web-browser. The URL: is

http://206.109.101.6/cgi-win/psl_ord.exe/ITEM14603

or follow the links at

http://www.ljusdal.se/esource

You can also go to

http://206.109.101.6/register.htm

and look up EsSock to make your online registration. But for the last time. This is only for Credit card orders.


We can invoice your organisation.

Some, mostly larger, companies need an invoice before they can make any financial transactions . We can handle this situation as well. Just send us a fax ( +46 657 10513) or email (f0002@brattberg.se) or use the online facilities at http://www.ljusdal.se/esource or send a letter to Brattberg, Gruvbyn 415A, S-820 50 LOOS, Sweden to place your order.

We will add a Invoice fee (Currently $10) and sails tax (if you are located within the European Community) to your order. You get a credit of 30 days. We usually ship the control the same day we receive your order.


You can send us a check.

If you send us a check it should be made payable to Brattberg, Gryvbyn 415A, S-820 50 LOOS, Sweden. Please add $5 to the total amount of your order if you use this option. If you fax us a copy of your check we will ship the control to you (just email) the same day we receive the fax.


You can make a bank transfer to us.

There are several options you can use for this kind of transfer. You can make a SWIFT transfer to FOBA SESS 7759-15-01828.

You can use our Banktransfer account (Bankgiro in Swedish) which is 5321-5117


You can send money in an envelop.

Put the money for the control in an envelop and post to us. This works most of the time but the risk is yours not ours.


Registration Fees

EsSock Control for USD 12

You get access to all versions of a control under one year. This means that a control that is published as 16-bit/32-bit ActiveX (OCX) and 16-bit/32-bit DLL and a VBX are all covered by this registration fee. You also get free support.

Brattberg Control Subscription for USD 450

Yes its only $450! This option gives you all controls and all source produced in our company for one year. You also get support and all other favors as if you bought each of the controls.

Traditional media (Diskette) add USD 10

We ship anywhere in the world with World-wide First Class/Airmail if you select this option. The only media supported is 3.5" diskettes.


Additional information we want from you when you place an order:

  1. If you want your control to be sent to you by email we need your email address. We also want to know if you prefer MIME (base64) or BINHEX coding of the control attachment.
  2. You can get access to a protected directory on our WWW-server where you can fetch your registered control. If you want this option please state so in your order.
  3. If you want to be added to the EsSock mailing list please state so. This is the official support channel for EsSock.
  4. If you want to be added to the EsSock auto distribution list please state so. By participating in this option you get all updates of the EsSock control automatically sent to you as soon as they are available.

Mailing Lists & Support

You can get support by sending email to f0002@brattberg.se. You can also find relevant information on-line at http://www.ljusdal.se/esource

We also have set up mailinglists for all of our controls. If you want to subscribe to the EsSock mailinglist send a letter to EsSock-request@ljusdal.se with "subscribe" as your subject. This will make you a subscriber of this list. You can also send a letter with "help" as the subject to get more information. To unsubscribe to the list just send a letter with "unsubscribe" as the subject. After a subscribing to a list you can send your comments, questions etc. to EsSock@ljusdal.se.

We also have mailinglists for all other controls and

  1. brattberglist@ljusdal.se which contains news about our company and our products. This is news about controls, the company, new technologies and other things we think can be of interest to our customers and partners. If you want to subscribe send a letter to brattberg-request@ljusdal.se with "subscribe" as your subject.
  2. activex@ljusdal.se which contains news information about the ActiveX technology and our ActiveX controls. If you want to subscribe send a letter to activex-request@ljusdal.se with "subscribe" as your subject.
  3. vbx@ljusdal.se which contains news information about the VBX technology and our VBX controls. If you want to subscribe send a letter to activex-request@ljusdal.se with "subscribe" as your subject
  4. dll@ljusdal.se which contains news information about our DLL controls. If you want to subscribe send a letter to activex-request@ljusdal.se with "subscribe" as your subject
  5. You can find forms for subscribing to the mailinglists at http://www.ljusdal.se/esource

We also check the newsgroup comp.lang.basic.visual.3rdparty on a regular basis and will try to help on all questions posted there we also check the relevant newsgroups at the Microsoft news server from time to time.


How to contact us

If you need to contact us the preferred way is through email. Please send a mail to f0002@brattberg.se

If you want to use phone please call us at +46 657 10620 and if you want to fax us please use +46 657 10513.

If you want to send a snailmail you can send it to

BRATTBERG, Gruvbyn 415A, S-820 50 LOOS, SWEDEN

License

We have a very liberal license policy so please read the license agreement text below . You are not allowed to use this control for other then evaluation purposes without register it with us. But if you are a student or involved in a non-profit organization there is no registration fee. Please read the license agreement to find out if you are entitled to a free registration or not.

If you intend to use the control in a commercial organization or want to develop an application which you intend to sell you will find that the license cost is very moderate. Please read the complete license agreement.

Brattberg End User License agreement (EULA)