Grant's CGI Framework
Documentation: TCP Networking

Version: 2.0d7
Release Date: November, 1997
Expires no later than: January 31, 1997

Important: THIS DOCUMENTATION IS INCOMPLETE AND PROBABLY A BIT INACCURATE

It is subject to change as the API matures.
Feedback and contributions are encouraged:

grantcgi@list.nisto.com
or grant@kagi.com

Warning: THE TCP CODE FOR CGI APPLICATIONS IS COMPLETELY UNTESTED!
You are strongly encouraged to wait for the next release before using
the tcp code when compiling as a CGI application!

It is safe to use when compiling as a WebSTAR (W*API) Plug-In.


TCP CLIENT

TCPOpenClientStream

CGIErr TCPOpenClientStream ( APIData apidata, UInt32 serverIP, UInt16 serverPort, TCPPtr *tcpData )

Attempt to open a client TCP/IP connection to a host machine.

serverIP
the IP address of the machine to form a TCP connection to.
serverPort
the TCP port to connect to.
tcpData
a pointer to a TCPPtr which will be set if this call is successful.

TCP LISTENERS

TCPListenStart

CGIErr TCPListenStart ( APIData apidata, UInt16 port, UInt16 maxConnections, UInt32 suggestedSize, TCPPtr *tcpData )

Open a TCP listener on the specified port.

port
tcp port to listen on.
maxConnections
maximum number of connections to support at one time.
suggestedSize
how much stack space should be allocated for each connection thread off this listener. Specify zero to use default size.
tcpData
a pre-allocated TCPRecord which will be filled in by this function.

TCPListenStop

CGIErr TCPListenStop ( APIData apidata, TCPPtr tcpData )

Stop a listener (that you previously set up using TCPListenStart). Halts any active connections from this listener.


STREAM ACCESS

TCPCloseStream

CGIErr TCPCloseStream ( APIData apidata, TCPPtr tcpData )

Close an open connection on a TCP stream.

TCPWriteToStream

CGIErr TCPWriteToStream ( APIData apidata, void *dataToSend, UInt32 dataLength, TCPPtr tcpData )

Read data onto an open TCP stream.

dataToSend
a buffer containing dataLength bytes to be sent on the TCP connection.
dataLength
number of bytes to send from the dataToSend buffer.

TCPGetStreamStatus

CGIErr TCPGetStreamStatus ( APIData apidata, TCPStreamStatus *outStatus, UInt32 *bytesUnread, TCPPtr tcpData )

Get status information on the stream.

outStatus
will be set to a code representing the current status of the stream specified by tcpData.
bytesUnread
will be set to the number of incoming bytes available to be read from the stream.

ADDRESS / DOMAIN NAME SERVICES

TCPNameToIPAddress

CGIErr TCPNameToIPAddress ( APIData apidata, char *name, UInt32 *ipAddress )

Get the long integer (4 byte) IP address for a given domain name.

name
the domain name to locate the IP address for.
ipAddress
will be set to the address for the domain name if there are no errors.

TCPIPAddressToName

CGIErr TCPIPAddressToName ( APIData apidata, UInt32 ipAddress, char *domainName )

Get the domain name (or IP addr) string for the 4 byte IP address.

ipAddress
4 byte long integer representing an IP address.
domainName
must be an existing 256 byte buffer. It will be set to the found domain name, or to the IP address in string format if the name can't be found.

Grant's CGI Framework

Contents: Nisto - Products - Mail Lists - Cree - Standards - Babylon 5

Privacy Statement, Legal Notices
Copyright ©1997-1998 Grant Neufeld. All rights reserved. abc