The iASP_Sock component 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.
Follow the following five steps to start communication (the following
example is uses Visual Basic programming syntax).
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.
Note:- Set the TimeOut in milliseconds. |
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 returns the Timeout. |
public String Readln( ) |
IThis 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.
If you require technical support please send complete details about the
problem you are having to support@halcyonsoft.com.