iASP_Sock Component

Overview

This section demonstrates the usage of iASP_Sock component. The iASP_Sock component stands for Instant Active Server Page Socket. iASP_Sock exposes the WinSock API through a few simple properties and methods. It allows developers to build applications that connect to any TCP port and send or receive data.



Use the following links to view the details
:

Methods

How to Communicate?

Appendix A

Appendix B

Appendix C

Appendix A   shows different types of methods with their return values.
Appendix B   shows different types of variables with their default values.
Appendix C   shows different types of errors with their constant values.
 


Methods:

Up

 


How to Communicate?

Up

 

To communicate the user needs to use the following five methods:

Follow the following five steps to start communication (the following example is uses Visual Basic programming syntax).

Socket.Close


Appendix A

Up

 

Methods

Description

public boolean Open()  It establishes a connection to the specified host and port and returns the connection state. 

Returns :

true:-  Connection established.
false:- Connection was not established.
 

public String setRemoteHost() It sets the name of that Host to which the connection is to be established.
 
public void getRemoteHost() It returns the Host name on which the connection is established.
 
public float getVersion() It returns the released version of the iASP_Sock component which is in use.
 
public void setPort(int portNumber) It sets the RemoteHost's Port. If the Port is not specified then the connection is established on Port '110'.

NOTE:- RemoteHost property must be set before the Port.
 

public int getPort() It returns the Port on which the connection is established with the RemoteHost.
 
public void setTimeout(int seconds) Timeout is the maximum time that iASP_Sock waits for a response, from the remote site. The default is 60 seconds.

NOTE: Set the Timeout in seconds.
 

public int getTimeout() It returs the Timeout.
public String Readln( ) This method takes no parameters and returns a String value, terminated with a <CRLF> i.e. Carriage Return Line Feed.
If no String value is returned from the RemoteHost up till Timeoutseconds, error is generated.
 
public Object ReadBytes(int readbytes) This method reads a ByteArray from the RemoteHost.

Paramter :
readbytes :- The maximum number of bytes to be read from the RemoteHost.

Returns :
Returns the ByteArray as an Object.

If no ByteArray is returned from the RemoteHost up till TimeOutseconds, error is generated.
 

public String ReadBytesAsString(int readbytes) This method reads a ByteArray from the RemoteHost.

Paramter :
readbytes :- The maximum number of bytes to  be read from the RemoteHost.

Returns :
Returns the ByteArray as a String.

If no ByteArray is returned from the RemoteHost up till Timeoutseconds, error is generated.
 

public boolean Write(String) Writes the specified string to the connection.
 
public boolean WriteLn(String) Writes the specified string to the connection terminated with a<CRLF>.
 
public void Close()  It closes the connection.
 
NOTE : Timeout is the maximum time that iASP_Sock waits for a response from the remote site. 
The default is 60 seconds.

 


Appendix B

Up

 

Type 

Variables

Values (default)

public boolean  connected  false
public int Err  -1
public int  port  none
public String  remoteHost  null
public int  timeout  60 seconds
public String  version  "1.0"

 


Appendix C

Up

 

Errors

Constants

ERROR_IN_SOCKET 

0

CONNECTION_RESET 

1

ERROR_IN_REINTIALIZATION 

2

ERROR_IN_READING 

3

HOST_NOT_FOUND 

4

ERROR_IN_WRITING 

5

HOST_NOT_DEFINE

6

NO_CONNECTION_ESTABLISHED 

7

INVALID_BYTES_LENGTH

8


 

If you require technical support please send complete details about the problem you are having to support@halcyonsoft.com.


Copyright © 1998-2000, Halcyon Software Inc. All rights reserved.