ServerObjects Logo

AspSock 1.x

About AspSock 1.x

AspSock allows ASP developers to connect to any TCP I/P port on a server and send or receive data.

AspSock Installation

To use this ASP component move the DLL into a subdirectory (like \winnt\system32 for NT or \windows\system for Win95). Please use the version of regsvr32 that is included with this component or the version that comes with Microsoft ASP (they are the same version).

To register the component on the system change to the directory where you installed the DLL and type:

regsvr32 aspsock.dll

About purchasing AspSock

  1. The registration license fee covers only one CPU per license.
  2. Evaluation copies will expire. See the Expires property for details on determining when your copy will expire.

About Upgrades

  1. Users can upgrade for free for minor version changes. For example, upgrades from version 1.00 to 1.99 are free. The upgrade from 1.99 to 2.0 may carry an additional license fee.
  2. The latest version of the components are always available at   If a fee is associated with obtaining the upgrade it will be noted on that page.

Upgrade Instructions

To upgrade the component from a previous version please follow these steps:

  1. Stop all IIS related services such as Gopher, FTP and W3SVC.
  2. Change to the directory where the component is located and type "regsvr32 /u aspsock.dll"
  3. Move the new copy of aspsock.dll to the current directory and type "regsvr32 aspsock.dll"
  4. Restart the necessary services.

Questions about AspSock

How do I determine a cause of failure? If the component can determine the cause of a failure, that information will be stored in the Error property. So, for example, to print that information to the clients browser you could add the following code:
if not Socket.Connect then
  if Socket.Error <> ''" then
    strError = Socket.Error
    strError = "Unknown"
  end if
  Response.Write "Failure occured. Reason: " & strError
end if
"AspSock never works. I get Server object error 'ASP 0177:800401f3'." This error means "Invalid class string" -- in other words the call to CreateObject failed because the name object cannot be found by the OLE sub-system. Causes include:
  1. You really didn't run regsvr32 on the server after all.
  2. You ran regsvr32 but it reported an error.
  3. Someone modified security on part of the registry that's preventing the OLE subsystem from reading all or part of the HKEY_CLASSES_ROOT tree.
  4. The name of the object you are trying to create was mispelled or is incorrect.
  1. Determine if it's a permissions problem

    Add the anonymous user (used by IIS) to the Administrators group. The test page then worked, proving it was a permissions problem. Do not forget to remove the anonymous IIS user from the Admin group!

  2. Determine if it is a file permissions problem:

    After removing the Anonymous user from the Admin group, add failure auditing to the file (aspsock.dll), which will determine if the file was ever accessed (by the lack of the failure event). If it isn't, this makes it clear that the failure is prior to file access but go ahead and check file/directory permissions to make sure the anonymous IIS user can access the file.

  3. Check registry permissions

    Using Regedt32, do find on aspsock.dll. Check the permissions for the key (and sub keys), and make sure that the anonymous user has read rights. Do a find on the class-id, which contains the location value, and version, and check those permissions as well.

"AspSock never works. I get Server object error 80040154." This is the most common error reported. The error means that ASP could not create the object. Causes include:
  1. You never ran regsvr32 on the DLL. See installation section of this document.
  2. You registered the DLL with regsvr32 in one subdirectory and moved it to another.
  3. IIS does not have proper security permissions to access the DLL or the directory you installed it to. See the ASP FAQ ( for information on changing security.
  4. Your server may be running low on memory.
  5. Your evaluation copy has expired. If you purchased the product be sure you followed directions to install your product key.

Note: Some users have reported that restarting the server after registering the DLL was required to use the component. This should not be necessary but reportedly works in a few cases

How do I upgrade to the latest version? Download the latest "eval" version and follow the upgrade directions provided earlier in this document.
Can I redistribute this control with my products? The control is not intended for redistribution. If you wish to include the control with a package you are developing, contact for licensing details.
My component is licensed. Should the Expires property return a date? No. Licensed versions return N/A for an expiration date. The registration process (per the instructions you received) should be run on the server.
What are the minimum security requirements for AspSock and IIS/ASP? Technically, the only requirement AspSock has is that it must have access to the temporary directory as noted in one of the previous troubleshooting tips. But IIS and ASP have certain requirements that must be met to run properly. Thanks to Carl Howell for providing this information.
ASP script directory Creator Owner: Full Control (All)(All)
System: ""
Admin: ""
IUSR: (None)(RX)
\WinNT\ Creator Owner: Full Control (All)(All)
System: ""
Admin: ""
\WinNT\System32\ System: Full Control (All)(All)
Admin: ""
Inetsrv System: Full Control (All)(All)
Admin: ""
Everyone: (RX)(RX)
Does the 2 CPU license cover two servers or two processors? In accordance with the license agreement, the 2 CPU license would cover either 2 single CPU servers or 1 dual CPU server. With this pricing model, AspSock is far more inexpensive than any "competing" products.

Technical Support

If you require technical support please see our tech support page at

AspSock Properties

Property Description
CloseOnTimeout By default this value is true. The component will automatically close the connection on a timout error. If set to False the connection, if established will remain open. Version 1.43 or higher.
Connected Returns true if the component is currently connected to a remote port and false if not.
Error If the component detects a failure in a request the error information will be located in the Error property.
Expires If the component is an eval version the expires property will return the date that the component quits functioning.


Response.Write "Component Expires: " & Socket.Expires

LogFile Sets the log filename where the sent/received socket data is logged to. This is only for debugging and not to be used in a multi-user production environment. (only available in version 1.4.4 or greater).
Port Sets the TCP I/P port that AspSock will try to open.


Socket.Port = 119

RegisteredTo Returns the name of the company who licensed the product.
RemoteHost The remote host that the component will try and connect to.


Socket.RemoteHost = ""

TimeOut Timeout is the maximum time that AspSock should wait for a response from the remote server. The default is 30 seconds.


Socket.Timeout = 15

Version Gets the internal component version number.


Response.Write "Component Version: " & Socket.Version

AspSock Component Methods

Method Parameters Return Value Description
Close N/A N/A Closes the open connection.
Open N/A True/False Opens the connection to the RemoteHost server using the specified Port.
ReadLn N/A String Waits up to TimeOut seconds for a string value that is terminated by a LF. Max return length is 8192 bytes. 
ReadBytes intBytes Array of variants Waits for up to TimeOut seconds for a maximum of intBytes and returns them as a variant array of variants.
ReadBytesAsString intBytes String Waits for up to TimeOut seconds for a maximum of intBytes and returns them as a string.


Response.Write Socket.ReadBytesAsString(47)

Write strValue True/False Writes the specified string out to the connection.
WriteLn strValue True/False Writes the specified string out to the connection and terminates the line with a VbCrLf


Copyright 1996, 1997, 1998, 1999, 2000 by ServerObjects Inc. All Rights Reserved.