PowerTCP Winsock for ActiveX

from $249.00
Available Platforms
PowerTCP Winsock for ActiveX features

 

Tcp ActiveX Control

Use the Tcp control to easily implement any upper-layer protocol that is based on a TCP data stream. Features include:

  • Send method sends data to the server.
  • Receive method receives all available data.
  • Search Method supports variable length records and line processing, eliminating the need to search for termination characters and simplifying buffer management.
  • Fill Method supports fixed length binary records, simplifying buffer management and reducing the code needed to send and receive binary structures.
  • Proxy support, including Socks 4 and 5

 

Development Environments

  • Visual Studio .NET (.NET Framework)
  • Visual Basic (VB)
  • Visual C++ (VC++)
  • FoxPro
  • PowerBuilder
  • Delphi
  • C++ Builder
  • ASP
  • Office 97/2000

 

Interface
Public Properties
Blocked A True value indicates the control is currently executing a blocking method (Timeout is greater than 0), which has neither completed nor timed out with a ptTimeout error.
KeepAlive When set to True, the KEEPALIVE socket option is set to monitor dropped connections. This option can only be set when the State property is tcpConnected.
LocalAddress Returns the address of the local host in dot notation (for example, nnn.nnn.nnn.nnn). When not connected, it returns an empty string.
LocalPort Returns the port number that the socket is bound to. When not connected, it returns 0.
NoDelay When True, the NODELAY socket option is set to defeat Nagle's algorithm.
ProxyHost Specifies the name or address of the proxy server that requests are to be routed through.
ProxyPassword Password to be sent on all requests through a proxy server that requires authentication.
ProxyPort Specifies the port used by proxy server that requests are to be routed through.
ProxyType The type of proxy server used for this connection.
ProxyUsername Username to be sent on all requests through a proxy server that requires authentication.
ReceiveBufferCount Checks for the existence of data without removing it.
ReceiveBufferSize Number of bytes the system has for buffering incoming data.
Ref Stores a reference to another object, data type, or value.
RemoteAddress Returns the address of the remote host in dot notation (i.e. nnn.nnn.nnn.nnn) when the State property is tcpConnected.
RemotePort Returns the port number of the remote host when the State property is tcpConnected.
ReuseAddress When True, the REUSEADDR socket option is set to accept duplicate use of the same LocalAddress / LocalPort pair (these are optional parameters of the Connect and Listen methods). If used, this property must be set prior to calling the Connect or Listen method and can be set at design time.
RemotePort Returns the port number of the remote host when the State property is tcpConnected.
ReuseAddress When True, the REUSEADDR socket option is set to accept duplicate use of the same LocalAddress / LocalPort pair (these are optional parameters of the Connect and Listen methods). If used, this property must be set prior to calling the Connect or Listen method and can be set at design time.
SendBufferCount When the Send method is used, some data may be stored in a buffer and later submitted to the system. The Send event fires to indicate that the system has accepted the submitted data.
SendBufferSize Number of bytes the system uses for buffering outgoing data.
Socket System identifier assigned to the TCP connection. It is normally used to assume management of an accepted socket from the Daemon Control.
State Provides status information to the user interface. The State event fires to signal that this property has changed.
Timeout Controls the blocking behavior of methods that can be used in blocking and non-blocking ways.
Public Methods
Abort Abort any blocking method and release all system resources.
About Show the About Box.
Close Close the session and release all system resources. A single control can be used for many connections, one after the other.
Connect Establish a connection. The State property immediately changes to tcpConnecting and then changes to tcpConnected when the connection is established. The State property can be checked in the body of the State event, polled off a timer, or checked immediately after this method is used when a positive Timeout is specified.
Fill Use this method when you know exactly how many bytes or characters you want from the TCP stream. Data is either filled to capacity or no data is returned. This method is useful for processing fixed-length records that can include binary structures.
Receive Receive an arbitrary amount of data. The specified String or Byte array is filled with bytes from the remote host.
Search Receive data up to and including a terminating sequence. The data stream is searched for the specified Token, and the specified string, byte array, or DartStream object is filled with the data stream up to and including the specified Token.
Send Send data after a connection is established. The Send event fires when data is accepted by the system. The SendBufferCount property always indicates the number of bytes that have been submitted but have not yet been accepted by the system.
Trace Start or stop the accumulation of trace or debug data. Once started, this method accumulates data until it is turned off.
Public Events
Error Fires when an error condition occurs.
Receive Fires when ReceiveBufferCount changes.
Send Fires when the system accepts data for sending.
State Fires when the State property changes.

 

Code Example

How easy is the TCP ActiveX component to use? Check out the following TCP VB example below, which demonstrates connecting to an Echo server and sending and receiving data.

 

Dim Reply As String

' Set Timeout to 1000 milliseconds to wait on communications for program execution
Tcp1.Timeout = 1000

' Establish a connection to an echo server that repeats back what it receives
' "myhostname" is the host address, and 7 indicates the echo port
Tcp1.Connect "myhostname", 7

' Since no Error condition is reported, we know we succeeded: send a string
Tcp1.Send "!"

' Receive the reply from the server
Tcp1.Receive Reply

If Reply = "!" Then MsgBox "Success!"

' Close the connection
Tcp1.Close

 

Return to Overview