Copyright: © 1996 Wilson WindowWare, Inc.


yesTRUEyesyesyesyesWXSock Extender Help Filewxsockyesyes18/12/96


APPENDIX A: Winsock error codes

APPENDIX. B: Dial-Up Networking return codes

About WIL Extenders

Using WIL Extenders

Contacting Graphical Dynamics

How to get Technical Support

About this Help File

Simple Command List

Winsock Command Reference

wxHost2Addr(hostname)

wxAddr2Host(hostaddress)

wxPing

wxParmGet(request#)

wxParmSet(request#)

FTP Overview

FtpOpen(hostname, username, password, account, attempts)

FtpClose(hSession)

FtpGet(hSession, remote-file, local-file, transfer-type)

FtpPut(hSession, local-file, remote-file, transfer-type)

FtpList(hSession, remote-path, local-file)

FtpChDir(hSession, remote-path)

FtpQuote(hSession, command)

FtpRename(hSession, remote-oldname, remote-newname)

FtpDelete(hSession, remote-file)

Dial-Up Networking Command Overview

DUNConnect

DUNDisconnect

DUNItemize

APPENDIX. B: Dial-Up Networking return codes

HTTP Command Overview

HTTPAuth(user-ID, password)

HTTPGetAnchor

HTTPGetDir

HTTPGetFile

HTTPGetPath

HTTPGetQuery

HTTPGetServer

HTTPPostQuery

HTTPRecvText

URLDecode

URLEncode

URLGetScheme

POP3 Command Overview

P3Close

P3Count

P3Delete

P3GetReply

P3Open

P3Peek

P3RecvText

SMTP Command Overview

SMTPSendText

Sockets Command Overview

SByteOrder16 SByteOrder32

SClose

SConnect

SGetLastErr

SOK2Recv

SOK2Send

SOpen

SRecvBinary

SRecvLine

SRecvNum8 SRecvNum16 SRecvNum32

SSendBinary

SSendNum8 SSendNum16 SSendNum32

SSendString SSendLine

SSendLine

AddExtender(filename)

LastError( )

Net101

NetInfo(requestcode)


Table of Contents
About WIL Extenders Using WIL Extenders Simple Command Reference Complete Command Reference Winsock Error Codes Dial-Up Networking Return Codes Contacting Graphical Dynamics How to get Technical Support About this Help File	The Winsock Extender contains a slew of functions which allow communication between host computers, Internet Service Providers and supported networks for Windows 95 and Windows NT operating systems.  These functions include high level operations (including ftp, http, smtp, pop3, and ping) as well as low level operations consisting of various direct WinSock calls.   The Winsock Extender can… Communicate over any TCP/IP supported network with the socket commands.  Connect to an Internet Service Provider with the Dial-Up Networking (DUN) commands.   Use the HTTP commands to request files from a web server. Transfer files from a remote host computer with the FTP family of functions.   Check your mailbox for incoming Internet mail via the POP3 commands.  Send outgoing mail with Simple Mail Transport Protocol (SMTP). These functions are used within WIL scripts you create to automate tasks involving Internet (via WinSock) tasks.


About WIL Extenders

WIL extender Dlls are special Dlls designed to extend the built-in function set of the WIL processor.  These Dlls typically add functions not provided in the basic WIL set, such as network commands for particular networks (Novell, Windows for WorkGroups, LAN Manager and others), MAPI, TAPI, and other important Application Program Interface functions as may be defined by the various players in the computer industry from time to time.  These Dlls may also include custom built function libraries either by the original authors, or by independent third party developers.  (An Extender SDK is available).  Custom extender Dlls may add nearly any sort of function to the WIL language, from the mundane network math or database extensions, to items that can control fancy peripherals, including laboratory or manufacturing equipment. WIL extenders must be installed separately.  Up to 10 extender Dlls may be added.  The total number of added items may not exceed 200 functions and constants.  The AddExtender function must be executed before attempting to use any functions in the extender library.  The AddExtender function should be only executed once in each WIL script that requires it.	Using WIL Extenders


Using WIL Extenders

Accessing the additional functionality available in WIL Extender Dlls is simple.  At the top of each script in which WIL Extender commands are to be used add the appropriate extender with the AddExtender command. AddExtender(extender filename) The WIL interpreter will search for the extender DLL's.  If no path is specified in the AddExtender statement, the WIL interpreter will search the current directory, the windows directory and on directories on the path. The extender DLL's must be available or the AddExtender line will return an error.  The AddExtender function should only be executed once for each extender dll in each WIL script that requires it.  Per script you can add up to 10 extender Dlls or a combined total of 200 functions.	About WIL Extenders Compiling with WIL Extenders


Contacting Wilson WindowWare
Contacting Graphical Dynamics

Graphical Dynamics, Inc.       2701 California Ave. SW, Suite 301       Seattle, WA 98116 USA       Orders: (800) 779-1799       Voice: (206) 935-6032       Fax: (206) 935-2464       Email: info@graphicaldynamics.com Registered users of our software get manuals, technical support, use of Graphical Dynamics’ on-line information services, and special offers on new versions of Graphical Dynamics products.	Technical Support About WIL Extenders


How to get Technical Support

The Graphical Dynamics web site is an excellent technical resource. Use the Technical Support area find answers to common problems, alternate scripting methods, and sample code.  See the information on registering your copy (found in the ClockMan.hlp file) if you haven't done so yet. The latest versions of our software are available on-line. The places here may change at any time -- check your installation sheet for the most recent addresses. Internet Web page: http://www.graphicaldynamics.com  Internet FTP: ftp.graphicaldynamics.com in /pub Email:  support@graphicaldynamics.com	Contacting Graphical Dynamics About WIL Extenders


About this Help File

This extender adds certain network capability to  the Windows Interface Language (WIL) processing engine.  Please refer to the WIL Reference Manual for an introduction to WIL, as well as for complete documentation of the many functions available in WIL and the programs that use it.  This help file includes only topics and functions which are exclusive to this particular WIL Extender.	About WIL Extenders Using WIL Extenders
Notational Conventions Throughout this manual, we use the following conventions to distinguish elements of text: ALL-CAPS Used for filenames. Boldface Used for important points, programs, function names, and parts of syntax that must appear as shown. system Used for items in menus and dialogs, as they appear to the user. Small fixed-width Used for WIL sample code. Italics Used for emphasis, and to liven up the documentation just a bit.
Acknowledgments

This extender developed by Jennifer Palonus, Morrie Wilson and Richard Merit.

Documentation written by Tina Browning.


Simple Command List

The Winsock extender contains a multitude of commands which you're welcome peruse and utilize.  However, if you prefer the bare bones approach to scripting, only a few Winsock commands are completely essential.  These commands include: DUNConnect Dials up an Internet host, without making you respond to the “Connect to” dialog. DUNDisconnect Hangs up a specified dial-up Internet connection, or all existing connections. HTTPPostQuery Sends a “POST” request to a CGI program on a web server and returns the response. HTTPRecvText Downloads a text file from a web server. SMTPSendText Sends a text-only email message.  FtpOpen(host name, username, password, account, attempts) Opens an FTP session on a remote host. FtpClose(hSession) Closes an FTP session FtpGet(hSession, remote-file, local-file, transfer-type) Copies a file from a remote FTP server to the local machine. FtpPut(hSession, remote-file, local-file, transfer-type) Sends a file from the local machine to a remote FTP server. wxPing Determines if a specified host is responding.	Winsock Command Reference Overview of Commands Dial-Up Networking  HTTP Commands  POP3 Commands  SMTP Commands  Sockets Commands  FTP Commands


Dial-Up Networking Command Overview

The Dial-Up Networking (DUN) commands let your modem dial an Internet Service Provider (ISP) without having to respond to the “Connect To” dialog, which you normally see when you run an Internet program such as a web browser. The list of Dial-Up Networking commands include: DUNConnect Dials up an Internet host, without making you respond to the “Connect to” dialog. DUNDisconnect Hangs up a specified dial-up Internet connection, or all existing connections. DUNItemize Creates a list of all the valid Dial-Up Networking hosts. These are the ones the user normally chooses from when they connect to the Internet via the “Connect To” dialog.	Winsock Command Reference Dial-Up Networking return codes Overview of Commands HTTP Commands  POP3 Commands  SMTP Commands  Sockets Commands  FTP Commands


HTTP Command Overview

HTTP (short for “Hyper-Text Transfer Protocol”) is the protocol used to request files from a web server. The list of HTTP commands include: HTTPAuth(user-ID, password) Sets Access Authorization for subsequent HTTPRecvQuery and HTTPRecvText commands. HTTPGetAnchor Extracts the anchor name from an HTTP URL. HTTPGetDir Extracts the full directory path from an HTTP URL. HTTPGetFile Extracts the filename from an HTTP URL. HTTPGetPath Extracts the file’s full pathname from an HTTP URL. HTTPGetQuery Extracts a CGI query string from an HTTP URL. HTTPGetServer Extracts the server’s domain name from an HTTP URL. HTTPPostQuery Sends a “POST” request to a CGI program on a web server and returns the response. HTTPRecvText Downloads a text file from a web server. URLDecode Takes a string in URL encoded format and converts it to plain text. URLEncode Takes a plain text string and converts it to URL encoded format. URLGetScheme Extracts the scheme from a URL.  When a web browser needs to get a file from a web server, the client app takes the URL that the user specified and extracts the server name and file’s pathname. It then connects to the server and requests the file. The server then sends back the file, along with several lines of header information used by the  browser to determine how to display the data (as an HTML page, a GIF graphic, etc.). The HTTPRecvText command can be used to emulate a web browser. When a user fills out a form online, the browser collects the data from the various fields into one long string (in a format called “urlencoded”) and pastes it onto the end of a URL specifying a “CGI” script located on the server computer. The browser then sends a “POST” request to the web server, which in turn passes the query string on to the CGI program.  The CGI program decodes the query string, processes the request, creates an HTML file on the fly, and sends the results back to the browser. (This is the page you see after you hit the “Submit” button that says something like “This form successfully completed…” or else shows you the search results you asked for.) If you need to call a web site and post a query automatically, run the query string through URLEncode and send it off to the server with HTTPPostQuery. If you can’t handle CGI scripting on your Web site, you can create a form on your web page which creates an email message from the urlencoded query string and mails it to your mailbox. These messages will have a line in the header that says “Content-Type: application/x-www-form-urlencoded”. The sample ScanMail.wbt script shows how the POP3 and URLDecode functions can be used to check a mailbox and process these messages automatically.	Winsock Command Reference Overview of Commands Dial-Up Networking  POP3 Commands  SMTP Commands  Sockets Commands  FTP Commands


POP3 Command Overview

Checking your mailbox for incoming mail is accomplished on the Internet via “Post-Office Protocol v3”, or POP3. To check your mailbox you must first start a POP3 session with your mail server by calling P3Open. The mail server name is usually the same as you would use to send mail via the SMTP commands – i.e. “mail.nerdsrus.com”. With the POP3 session started, you can query the number of messages in your mailbox with P3Count; Look at a number of the first lines with P3Peek, download the whole message with P3RecvText, and then delete the messages from the server with P3Delete. When you’re finished, call P3Close to close the POP3 session. P3Close Closes a POP3 session. p3Count Counts the number of messages in your mailbox. p3Delete Deletes a message from your mailbox. p3GetReply Returns the description from the last POP3 reply code. p3Open Opens a session with a POP3 mail server. p3Peek Reads the header & first few lines of a message in your mailbox. p3RecvText Downloads a message from your mailbox.	Winsock Command Reference Overview of Commands Dial-Up Networking  HTTP Commands  SMTP Commands  Sockets Commands  FTP Commands


SMTP Command Overview

Simple Mail Transport Protocol (SMTP) is the protocol used to send outgoing mail through the Internet. To send mail, first specify a mail server. If you use an Internet Service Provider, the mail server name is usually the same as your ISP’s domain name with a prefix of “mail.”. (For example, nerdsrus.com probably uses “mail.nerdsrus.com”.) They probably told you this information when you first signed up with the ISP, since all mail programs require it. Checking your mailbox for incoming mail is more complicated, and requires a different protocol called “POP3”. Hence our P3xxx commands. SMTPSendText Sends a text-only email message.	Winsock Command Reference Overview of Commands Dial-Up Networking  HTTP Commands  POP3 Commands  Sockets Commands  FTP Commands


Sockets Command Overview

Windows Sockets is the underlying system that lets you communicate over the Internet (or over any network that supports TCP/IP). The list of Socket functions include: SByteOrder16, SByteOrder32(number, direction mode) Converts a 16- or 32-bit binary number from network byte order to the PC’s byte order & vice versa. SClose(socket) Closes a socket. SConnect(socket, hostaddr, service) Connects a socket to an Internet host & network service (i.e. “ftp”). SGetLastErr() Gets the last error generated by a Winsock extender function. SOK2Recv(socket, size) Checks the status of the socket to see if there is data waiting to be read. SOK2Send(socket) Checks to see if data can be sent without waiting. SOpen() Creates a new stream (TCP) socket. SRecvBinary(socket, blob, size) Gets binary data from a socket into a binary data type created with BinaryAlloc. SRecvLine(socket, maxsize) Gets a line of text from a socket, up to the first CR/LF. SRecvNum8, SRecvNum16, SRecvNum32(socket) Gets numeric data from a socket and converts the result from network byte order to PC byte order. SSendBinary(socket, blob, size) Sends binary data to a socket. SSendNum8, SSendNum16, SSendNum32(socket, number) Sends an integer to a socket. SSendString(socket, string) SSendString sends a string to a socket.  SSendLine(socket, string) SSendLine will first append a CR/LF on the end of the string if it isn’t already there.	Winsock Command Reference Overview of Commands Dial-Up Networking  HTTP Commands  POP3 Commands  SMTP Commands  FTP Commands


FTP Overview

The FTP family of functions allows you to establish a FTP session with remote host computer that is running a FTP server.  If the server supports FTP, these functions can communicate with it. In addition, Windows NT machines have an FTP server on the installation CD-ROM which can be installed. The list of FTP functions include: FtpOpen(host name, username, password, account, attempts) Opens an FTP session on a remote host. FtpClose(hSession) Closes an FTP session FtpGet(hSession, remote-file, local-file, transfer-type) Copies a file from a remote FTP server to the local machine. FtpPut(hSession, remote-file, local-file, transfer-type) Sends a file from the local machine to a remote FTP server. FtpList(hSession, remote-path, local-file) Obtains a directory listing from a remote FTP server. FtpChDir(hSession, remote-path) Changes the current directory on a remote FTP server. FtpQuote(hSession, command) Sends a command string to a remote FTP server. FtpRename(hSession, remote-oldname, remote-newname) Renames a file on a remote FTP server. FtpDelete(hSession, remote-file) Deletes a file from a remote FTP server. When transferring files, only one file may be transferred per function call.  No wildcards are permitted.  Use a separate FtpPut or FtpGet for each file.	Winsock Command Reference Overview of Commands Dial-Up Networking  HTTP Commands  POP3 Commands  SMTP Commands  Sockets Commands


WXSock Command Reference

WinSock Command Reference

The following WIL functions are useful when using WIL extenders.  AddExtender(filename) Installs a WIL extender Dll. LastError( ) Returns the last error encountered. Net101 NetInfo(requestcode) Determines network(s) installed. The following functions for Windows 95 and Windows NT can be added with the WWWSK32I.DLL using the AddExtender function. AddExtender("WWWSK32I.DLL")	Winsock Error Codes Dial-Up Networking return codes Using WIL Extenders Overview of Commands Dial-Up Networking  HTTP Commands  POP3 Commands  SMTP Commands  Sockets Commands  FTP Commands

wxHost2Addr(hostname)

Converts a host name into an address.

wxAddr2Host(hostaddress)

Converts a host address into an host name.

wxParmGet(request#)

Returns the value of a communication parameter used by the extender.

wxParmSet(request#)

Sets the value of communication parameters.

wxPing

Determines if a specified host is responding.

DUNConnect

Dials up an Internet host, without making you respond to the “Connect to” dialog.

DUNDisconnect

Hangs up a specified dial-up Internet connection, or all existing connections.

DUNItemize

Creates a list of all the valid Dial-Up Networking hosts. These are the ones the user normally chooses from when they connect to the Internet via the “Connect To” dialog.

HTTPAuth(user-ID, password)

Sets Access Authorization for subsequent HTTPRecvQuery and HTTPRecvText commands.

HTTPGetAnchor

Extracts the anchor name from an HTTP URL.

HTTPGetDir

Extracts the full directory path from an HTTP URL.

HTTPGetFile

Extracts the filename from an HTTP URL.

HTTPGetPath

Extracts the file’s full pathname from an HTTP URL.

HTTPGetQuery

Extracts a CGI query string from an HTTP URL.

HTTPGetServer

Extracts the server’s domain name from an HTTP URL.

HTTPPostQuery

Sends a “POST” request to a CGI program on a web server and returns the response.

HTTPRecvText

Downloads a text file from a web server.

URLDecode

Takes a string in URL encoded format and converts it to plain text.

URLEncode

Takes a plain text string and converts it to URL encoded format.

URLGetScheme

Extracts the scheme from a URL.

P3Close

Closes a POP3 session.

p3Count

Counts the number of messages in your mailbox.

p3Delete

Deletes a message from your mailbox.

p3GetReply

Returns the description from the last POP3 reply code.

p3Open

Opens a session with a POP3 mail server.

p3Peek

Reads the header & first few lines of a message in your mailbox.

p3RecvText

Downloads a message from your mailbox.

SMTPSendText

Sends a text-only email message.

SByteOrder16, SByteOrder32(number, direction mode)

Converts a 16- or 32-bit binary number from network byte order to the PC’s byte order & vice versa.

SClose(socket)

Closes a socket.

SConnect(socket, hostaddr, service)

Connects a socket to an Internet host & network service (i.e. “ftp”).

SGetLastErr()

Gets the last error generated by a Winsock extender function.

SOK2Recv(socket, size)

Checks the status of the socket to see if there is data waiting to be read.

SOK2Send(socket)

Checks to see if data can be sent without waiting.

SOpen()

Creates a new stream (TCP) socket.

SRecvBinary(socket, blob, size)

Gets binary data from a socket into a binary data type created with BinaryAlloc.

SRecvLine(socket, maxsize)

Gets a line of text from a socket, up to the first CR/LF.

SRecvNum8, SRecvNum16, SRecvNum32(socket)

Gets numeric data from a socket and converts the result from network byte order to PC byte order.

SSendBinary(socket, blob, size)

Sends binary data to a socket.

SSendNum8, SSendNum16, SSendNum32(socket, number)

Sends an integer to a socket.

SSendString(socket, string)

SSendString sends a string to a socket.

SSendLine(socket, string)

SSendLine will first append a CR/LF on the end of the string if it isn’t already there.

FtpOpen(host name, username, password, account, attempts)

Opens an FTP session on a remote host.

FtpClose(hSession)

Closes an FTP session

FtpGet(hSession, remote-file, local-file, transfer-type)

Copies a file from a remote FTP server to the local machine.

FtpPut(hSession, remote-file, local-file, transfer-type)

Sends a file from the local machine to a remote FTP server.

FtpList(hSession, remote-path, local-file)

Obtains a directory listing from a remote FTP server.

FtpChDir(hSession, remote-path)

Changes the current directory on a remote FTP server.

FtpQuote(hSession, command)

Sends a command string to a remote FTP server.

FtpRename(hSession, remote-oldname, remote-newname)

Renames a file on a remote FTP server.

FtpDelete(hSession, remote-file)

Deletes a file from a remote FTP server.


AddExtender(filename)

Installs a WIL extender Dll.

Syntax:

AddExtender(filename)

Parameters:

(s) filename	WIL extender Dll filename.

Returns:

(i)	@TRUE if function succeeded.
@FALSE if function failed.

WIL extender Dlls are special Dlls designed to extend the built-in function set of the WIL processor.  These Dlls typically add functions not provided in the basic WIL set, such as network commands for particular networks (Novell, Windows for WorkGroups, LAN Manager and others), MAPI, TAPI, and other important Application Program Interface functions as may be defined by the various players in the computer industry from time to time.  These Dlls may also include custom built function libraries either by the original authors, or by independent third party developers.  (An Extender SDK is available).  Custom extender Dlls may add nearly any sort of function to the WIL language, from the mundane network, math or database extensions, to items that can control fancy peripherals, including laboratory or manufacturing equipment.

Use this function to install extender Dlls as required.  Up to 10 extender Dlls may be added.  The total number of added items may not exceed 200 functions and constants.  The AddExtender function must be executed before attempting to use any functions in the extender library.  The AddExtender function should be only executed once in each WIL script that requires it.

The documentation for the functions added are supplied either in a separate manual or disk file that accompanies the extender Dll.

Example:

; Add vehicle radar processing dll controlling billboard visible to
; motorists, and link to enforcement computers.
; The WIL Extender SPEED.DLL adds functions to read a radar speed
; detector(GetRadarSpeed) , put a message on a billboard visible to
; the motorist (BillBoard), take a video of the vehicle (Camera), and
; send a message to alert enforcement personnel (Alert) that a
; motorist in  violation along with a picture id number to help
; identify the offending vehicle and the speed which it was going.
;
AddExtender("SPEED.DLL")
BillBoard("Drive Safely")
While @TRUE
; Wait for next vehicle
while GetRadarSpeed()<5	; if low, then just radar noise
Yield	; wait a bit, then look again
endwhile
speed=GetRadarSpeed()	; Something is moving out there
if speed < 58
BillBoard("Drive Safely")	; Not too fast.
else

if speed < 63
BillBoard("Watch your Speed")	; Hmmm a hot one
else
if speed < 66
BillBoard("Slow Down")	; Tooooo fast
else
BillBoard("Violation  Pull Over")
pictnum = Camera()	; Take Video Snapshot
Alert(pictnum, speed); Pull this one over
endif
endif
endif
endwhile

See Also:

DllCall  (found  in main WIL documentation)


LastError( )

Returns the most-recent error encountered during the current WIL program.

Syntax:

LastError( )

Parameters:

None

Returns:

(i)	most-recent WIL error code encountered.

In addition to the normal behavior of the LastError function documented in the WIL Reference Guide, if the most recent error occurred in a WIL Extender, then a number assigned by the Extender will be returned.  The numbers are documented in the appendix of this Extender document.

It may be possible to obtain error numbers not documented.  The "Notes" section of the WIL manual has been provided to allow you to keep records of undocumented error codes.

Example:

;Access script with some error checking
;
OnCancel="Exit"	; Setup default "cancel" processing

retcode = AddExtender("wwn3x16i.dll")	;Load in Novell 3 extender
if retcode == 0
;This code should not even get the chance to execute.
;Fail-safe error checking here
Message("Error","Failed to load Novell 3 extender")
endif

MyServer="\\DEPT07"
UserID="FRED"

ErrorMode(@OFF)	;Tell WIL we want to handle errors in script

:TRYPSWD
OnCancel = "goto DETACH"
Pswd=AskPassword("Login to Server %MyServer%", "Enter Password for %UserID%")
OnCancel = "exit"
retcode = n3Attach(MyServer, UserID, Pswd)
if retcode == 0
errcode=LastError()
if errcode == 128
Message("Bad Password Error","Bad password supplied for Userid %UserID%")
goto TRYPSWD
endif
Message("Login Error %errcode%","Login Failure")
if n3GetMapped(MyServer)=="" then n3Detach(MyServer)
exit
endif

; Find drive to map.  But don't use W, X, Y, or Z just to
; make it more interesting.
drives = DiskScan(0)
for I=1 to 4
nono = strcat( num2char( char2num("V") + I) , ":")
a = ItemLocate( nono,  drives, " ")
if a!=0 then drives = ItemDelete(a, drives, " ")
next

if ItemCount(drives, " ") == 0
Message("Error", "No drives available for mapping")
if n3GetMapped(MyServer)=="" then n3Detach(MyServer)
exit
 endif

usedrive=ItemExtract(1,drives," ")

n3Map("\\DEPT07\SYS\Excel", usedrive)
errcode=LastError()
if errcode != 0      ; Map Failue
Message("Map Error %errcode%","Map to %usedrive% failed")
if n3GetMapped(MyServer)=="" then n3Detach(MyServer)
exit
endif

OrigDir=DirGet()
DirChange(strcat(usedrive,"\"))
RunWait("EXCEL.EXE","/E")
errcode = LastError()
if errcode != 0
Message("RunWait Failed ???","Errorcode=%errcode%")
;drop thru to disconnect
endif
DirChange(OrigDir)
n3MapDelete(usedrive)

:DETACH
; Just in case user has other mappings to server, only
; detach (logout) from server if no other mappings exist
if n3GetMapped(MyServer)=="" then n3Detach(MyServer)
exit

:CANCEL
%OnCancel%
Message("Error","Oncancel variable improperly set up")
exit

See Also:

Debug, ErrorMode (both found  in main WIL documentation)


Net101

All network functionality for WIL is performed via "WIL Extenders", add-on Dlls for WIL, which contain Network commands for assorted networks.

NetInfo is the only WIL network function.  It returns the types of the networks currently active on the local machine, and can be used to help determine which network extenders should be loaded in multi-network environments.

Documentation for the various network extenders are found either in a manual for a particular extender or in an associated disk file.

See Also:

NetInfo, AddExtender, DllCall ( found  in main WIL documentation)


NetInfo(requestcode)

Determines network(s) installed.

Syntax:

NetInfo(requestcode)

Parameters:

(i) requestcode	0 for primary network name.
1 for secondary subnet list.

Returns:

(s)	Primary network name for request code 0, or

Secondary network list for request code 1.

Use this function to determine the network type(s) running on a workstation.  When running in a mixed network environment, it may be important to be able to determine the types of networks running on a workstation so as to be able to load the appropriate network extender Dlls and issue the corresponding commands.

NetInfo(0) will return the name of the primary network, or will return "MULTINET" , which indicates the Windows multinet driver is active and the secondary subnet list should be queried.  NetInfo(0) will return one of the following strings:

NetInfo(0) return values:

NONE	No network installed

MULTINET	Multinet driver installed, see subnet codes.

MSNET	Microsoft Network

LANMAN	LAN Manager

NETWARE	Novell NetWare

VINES	Banyan Vines

10NET	10 Net

LOCUS	Locus

SUNPCNFS	SUN PC NFS

LANSTEP	LAN Step

9TILES	9 Tiles

LANTASTIC	Lantastic

AS400	IBM AS/400

FTPNFS	FTP NFS

PATHWORK	DEC PathWorks

OTHER1	Other (code 1)

OTHER2	Other( code 2)

UNKNOWN	Other (unknown)

If NetInfo(0) returned "MULTINET" then NetInfo(1) will return one or more of the following in a space delimited list:

NetInfo(1) return values:

NONE 	No networks active

MSNET 	Microsoft Network

LANMAN 	LAN Manager

WINNET 	Windows Network (Windows for Workgroups, etc)

NETWARE	Novell Netware

VINES	Banyan Vines

OTHER2	Other (code 0x20)

OTHER4 	Other (code 0x40)

OTHER8	Other (code 0x80)

32 Bit Windows

NetInfo(0) will always return the string "WINNT" for 32 bit Windows platforms, regardless of whether the platform is Windows95 or Windows NT.

Under Windows 95, NetInfo(1) will return a list of installed network client ID's, delimited with the standard file delimiter (by default, a tab).

Possible client ID's, with their corresponding descriptions, are:

Client ID   	Description

3OPEN       	3Com 3+Open (all versions)

3SHARE      	3Com 3+Share (all versions)

DLR         	IBM OS/2 LAN Server (versions below 1.2)

DLR12       	IBM OS/2 LAN Server (version 1.2)

DLR13       	IBM OS/2 LAN Server (versions 1.2, 1.3, and 1.2 without /API)

DLR13CSD    	IBM OS/2 LAN Server (version 1.3 CSD 5015/5050)

DLR20       	IBM OS/2 LAN Server (version 2.0)

FTPNFS      	FTP Software NFS Client (InterDrive 95)

LANMAN      	Microsoft Real Mode LAN Manager

LANT5       	Artisoft LANtastic (version 5.X and above)

MSNET       	Real mode MS-Net Compatible

NETWARE3    	Novell NetWare (Workstation Shell 3.X [NETX])

NETWARE4    	Novell NetWare (Workstation Shell 4.0 and above [VLM])

NOVELL32    	Novell NetWare Client 32

NWREDIR     	Client for NetWare Networks

PATHWKS     	DEC PATHWORKS (versions below 4.0)

PATHWKS40   	DEC PATHWORKS (version 4.x)

PCLP        	IBM PC LAN Program (all versions)

PCNFS50     	SunSoft PC-NFS (version 5.0)

VINES552    	Banyan DOS/Windows 3.1 client

VREDIR      	Client for Microsoft Networks

Under Windows NT, NetInfo(1) will return a list of installed network provider ID's, delimited with the standard file delimiter (by default, a tab).

Possible providers, with their corresponding descriptions, are:

Provider ID	Description

LanmanWorkstation    	Microsoft Windows Network

NetWareWorkstation   	NetWare Services

NWCWorkstation       	NetWare or Compatible Network

Example:

a=NetInfo(0)
if a=="MULTINET"
b=NetInfo(1)
count=ItemCount(b," ")
Message("Multinet supporting  %count% networks", b)
else
Message("Installed Network", a)
endif

See Also:

Net101, AddExtender, DllCall  (found  in main WIL documentation)


wxHost2Addr(hostname)

Converts a host name into a host address.

Syntax:

wxHost2Addr(host name)

Parameters:

(s) host name	Name of a host computer.

Returns:

(s)	Host dotted-quad address.

Communicates with a Domain Name Server (DNS) and converts an Internet host name into a dotted-quad host address.

Example:

AddExtender("WWWSK32I.DLL")

host="www.windowware.com"

hostaddr=wxHost2Addr(host)

Message(host,hostaddr)

See Also:

wxAddr2Host


wxAddr2Host(host address)

Converts a host address into an host name.

Syntax:

wxAddr2Host(host address)

Parameters:

(s) host address	Dotted-quad address of a host computer.

Returns:

(s)	Name of a host computer.

Communicates with a Domain Name Server (DNS) and converts an Internet dotted-quad host address into a host name.

Example:

AddExtender("WWWSK32I.DLL")

hostaddr="206.63.11.50"

host=wxAddr2Host(hostaddr)

message(host,hostaddr)

See Also:

wxHost2Addr


wxParmGet(request#)

Returns the value of a communication parameter used by the extender.

Syntax:

wxParmGet(request#)

Parameters:

(i) request#	parameter request number (see below).

Returns:

(i)	value of parameter.

wxParmGet allows access to a number of configurable communication parameters which control the duration before an operation times out and in the case of failure, the number of times the operation is retried.

Request#	Parameter	Default

1	DNS_TIMEOUT	15

2	PING_TIMEOUT	15

3	FTP_REPLY_TIMEOUT	60

4	FTP_TRANSFER_TIMEOUT	60

Example:

AddExtender("WWWSK32I.DLL")

value = wxParmGet(3)

message("FTP Reply Timeout", "Timeout is %value%")

See Also:

wxParmSet


wxParmSet(request#)

Sets the value of communication parameters.

Syntax:

wxParmSet(request#)

Parameters:

(i) request#	parameter request number (see below).

Returns:

(i)	previous value of parameter.

wxParmSet allows access to a number of configurable communication parameters which control the duration before an operation times out and in the case of failure, the number of times the operation is retried.

Request#	Parameter	Default

1	DNS_TIMEOUT	15

2	PING_TIMEOUT	15

3	FTP_REPLY_TIMEOUT	60

4	FTP_TRANSFER_TIMEOUT	60

Example:

AddExtender("WWWSK32I.DLL")

wxParmSet(3, 90)

See Also:

wxParmGet


wxPing

Determines if the specified host is responding.

Syntax:

wxPing(hostname/address)

Parameters:

(s) hostname/address	Name or address of a host computer.

Returns:

(i)	@TRUE  if host responds;

@FALSE if host seems uncommunicative.

wxPing sends a short message to another computer requesting a reply - a  "ping".  If the other computer is up and online, it usually will respond to a ping request.

wxPing verifies that a remote computer's "ping" server is operational.  If the ping server is operational, it may generally be implied that the remote computer's other servers are also operational. (Other servers may include FTP, HTTP(Web), and Telnet)

Example:

AddExtender("WWWSK32I.DLL")

host="www.windowware.com"

a=wxPing(host)

Message(host,"Ping = %a%")

hostaddr="206.63.11.50"

a=wxPing(hostaddr)

Message(hostaddr,"Ping = %a%")


DUNConnect

Dials up and connects to an Internet host, bypassing the “Connect to” dialog box.

Syntax:

DUNConnect (dial-up name)

Parameters:

(s) dial-up name	The Internet host to dial up, as returned from DUNItemize. (This
is the descriptive name the user would see in the “Connect To”
dialog, not the actual domain name.)

Returns:

(i)	A handle that identifies the connection, or @FALSE if error. If
you’re already connected to this host, then this handle identifies
the existing connection.

SGetLastErr():

@SOK	Dialed up the specified host successfully.

@SAlready	The dial-up is already connected. The return value identifies the
existing connection.

@SErrNotFound	Unknown host name specified.

600..750	Remote Access Service error code (See Dial-Up Networking
return codes).

Example:

AddExtender("WWWSK32I.DLL")

;Dial our host, asking first if user has more than 1 defined...

hConn = 0

sDialUps = DUNItemize ()

if (ItemCount(sDialUps,@TAB) == 1)

        sDial = sDialUps

else

        sDial = AskItemList ("Choose a dial-up connection", sDialUps, @TAB, @SORTED, @SINGLE)

endif

hConn = DUNConnect (sDial)

if (!hConn)

        nErr = SGetLastErr()

        Message (sTitle, "Couldn't connect to %sDial%. Error %nErr%.")

        exit

endif

Delay (5)

; Hang up...

:HangUp

nRet = DUNDisconnect (hConn)

See Also:

DUNItemize, DUNDisconnect


DUNDisconnect

Disconnects a specified dial-up Internet connection, or all existing connections, from an Internet host.

Syntax:

DUNDisconnect (connection)

Parameters:

(i) connection	The dial-up connection handle to disconnect (as returned from
DUNConnect), or 0 to disconnect all open connections.

Returns:

(i)	@TRUE if OK, else @FALSE if there was an error.

SGetLastErr():

@SOK	Disconnected from the host(s) successfully.

@SErrParam	Unknown connection handle specified.

600..750	Remote Access Service error code (See Dial-Up Networking
return codes).

Example:

AddExtender("WWWSK32I.DLL")

;Dial our host, asking first if user has more than 1 defined...

hConn = 0

sDialUps = DUNItemize ()

if (ItemCount(sDialUps,@TAB) == 1)

        sDial = sDialUps

else

        sDial = AskItemList ("Choose a dial-up connection", sDialUps, @TAB, @SORTED, @SINGLE)

endif

hConn = DUNConnect (sDial)

if (!hConn)

        nErr = SGetLastErr()

        Message (sTitle, "Couldn't connect to %sDial%. Error %nErr%.")

        exit

endif

Delay (5)

; Hang up...

:HangUp

nRet = DUNDisconnect (hConn)

See Also:

DUNItemize, DUNConnect


DUNItemize

Returns a delimited list of Dial-Up Networking hosts.

Syntax:

DUNItemize ()

Returns:

(s)	A tab-delimited list of dial-up hosts.

Creates a list of all the valid Dial-Up Networking hosts. These are the ones the user normally chooses from when they connect to the Internet via the “Connect To” dialog.

SGetLastErr():

@SOK	Created the list successfully.

600..750	Remote Access Service error code (See Dial-Up Networking
return codes).

Example:

AddExtender("WWWSK32I.DLL")

;Dial our host, asking first if user has more than 1 defined...

hConn = 0

sDialUps = DUNItemize ()

if (ItemCount(sDialUps,@TAB) == 1)

        sDial = sDialUps

else

        sDial = AskItemList ("Choose a dial-up connection", sDialUps, @TAB, @SORTED, @SINGLE)

endif

hConn = DUNConnect (sDial)

if (!hConn)

        nErr = SGetLastErr()

        Message (sTitle, "Couldn't connect to %sDial%. Error %nErr%.")

        exit

endif

Delay (5)

; Hang up...

:HangUp

nRet = DUNDisconnect (hConn)

See Also:

DUNConnect


HTTPAuth(user-ID, password)

Sets Access Authorization for subsequent HTTPPostQuery and HTTPRecvText commands.

Syntax:

HTTPAuth(user-ID, password)

Parameters:

(s) user-ID	a blank string ("") for "user-ID" to turn Access Authorization off.

(s) password	"password" may be a blank string ("").

Returns:

(s)	1

Provides a name and password for servers which require them.

Example:

See Also:

HTTPRecvText, HTTPPostQuery


HTTPGetAnchor

Extracts the anchor name from an HTTP URL.

Syntax:

HTTPGetAnchor (URL, anchor)

Parameters:

(s) URL	The URL to parse. This can be a fully-qualified URL or relative.

(s) anchor	The default anchor name to use.

Returns:

(s)	The full anchor name if found, else the default.

Anchors are used to link a web page to a specific place in second document. When a hotlink with an anchor is selected, it opens the second document at the desired position. A URL with an anchor will look like :  “http://www.server.com/anotherpg#theanchor”.

HTTPGetAnchor extracts “theanchor” from the URL above.

Example:

AddExtender("WWWSK32I.DLL")

a=HTTPGetAnchor("http://www.windowware.com/winware/download.html#winbatch","")

message("The anchor is", a)

See Also:

HTTPGetDir, HTTPGetFile, HTTPGetPath, HTTPGetServer


HTTPGetDir

Extracts the full directory path from an HTTP URL.

Syntax:

HTTPGetDir (URL, dirpath)

Parameters:

(s) URL	The URL to parse. This can be a fully-qualified URL or relative.

(s) dirpath	The default directory path to use.

Returns:

(s)	The full directory path if found, else the default.

Example:

AddExtender("WWWSK32I.DLL")

a=HTTPGetDir ("http://www.windowware.com/winware/download.html#winedit", "")

message("The directory is", a)

See Also:

HTTPGetAnchor, HTTPGetFile, HTTPGetPath, HTTPGetServer


HTTPGetFile

Extracts the filename from an HTTP URL.

Syntax:

HTTPGetFile (URL, filename)

Parameters:

(s) URL	The URL to parse. This can be a fully-qualified URL or relative.

(s) filename	The default filename to use.

Returns:

(s)	The filename if found, else the default.

Example:

AddExtender("WWWSK32I.DLL")

a=HTTPGetFile ("http://www.windowware.com/winware/download.html#winedit", "")

message("The file is", a)

See Also:

HTTPGetAnchor, HTTPGetDir, HTTPGetPath, HTTPGetServer


HTTPGetPath

Extracts the file’s full pathname from an HTTP URL.

Syntax:

HTTPGetPath (URL, dirpath)

Parameters:

(s) URL	The URL to parse. This can be a fully-qualified URL or relative.

(s) dirpath	The default directory path for the file.

Returns:

(s)	The full pathname of the file.

Example:

AddExtender("WWWSK32I.DLL")

a=HTTPGetPath("http://www.windowware.com/winware/download.html#winedit", "")

message("The path is", a)

See Also:

HTTPGetAnchor, HTTPGetDir, HTTPGetFile, HTTPGetServer


HTTPGetQuery

Extracts a CGI query string from an HTTP URL.

Syntax:

HTTPGetQuery (URL, query string, maxsize)

Parameters:

(s) URL	The URL to parse. This can be a fully-qualified URL or relative.

(s) query string	The default query string to use.

(i) maxsize	Max chars of data to receive.

Returns:

(s)	The full query string if found, else the default.

URL query strings, consisting of information entered into a form in a web browser, are passed to the CGI script in “urlencoded format”.  URL query strings are always placed at the end of the URL and are preceded by a CGI script filename and a "?".  HTTPGetQuery accesses the URL and extracts only the query string from the URL.

http://webbatch.windowware.com/webcgi/webbatch.exe?techsupt/techsupt.web

Example:

URL="http://webbatch.windowware.com/webcgi/webbatch.exe?techsupt/techsupt.web"

que=HTTPGetQuery(URl, "", 100)

Message("Query string is", que)

See Also:

HTTPPostQuery, HTTPRecvText, URLDecode, URLEncode,URLGetScheme


HTTPGetServer

Extracts the server’s domain name from an HTTP URL.

Syntax:

HTTPGetServer (URL, domain name)

Parameters:

(s) URL	The URL to parse. This can be a fully-qualified URL or relative.

(s) domain name	The default domain name to use.

Returns:

(s)	The domain name if found, else the default.

Example:

AddExtender("WWWSK32I.DLL")

a=HTTPGetServer ("http://www.windowware.com/winware/download.html#winedit", "")

message("The Server is", a)

See Also:

HTTPGetAnchor, HTTPGetDir, HTTPGetFile, HTTPGetPath


HTTPPostQuery

Sends a “POST” request to a CGI program on a web server and returns the response.

Syntax:

HTTPPostQuery(server, path, query, maxsize, hdr mode)

Parameters:

(s) server	The web server to get the file from.

(s) path	The pathname of the CGI script on the server's computer.

(s) query	The query string for the CGI script.

(i) maxsize	Max chars of data to receive.

(i) hdr mode	@TRUE if you want to receive the HTTP header lines as well as
the data, else @FALSE.

Returns:

(s)	The CGI program’s output, optionally with the HTTP header lines at the beginning.

SGetLastErr():

@SOK	Received the response OK.

@SErrNoConn	Server closed the connection before sending anything back.

Other errors from SOpen, SConnect, SSendLine, or SRecvLine.

Each HTTP reply starts with several lines of header information with a blank line before the requested data.

A standard CGI query string consists of one or more “name=value” pairs, each separated by “&”. If you’re simulating a user entering data in a web form, each name=value pair corresponds to a field on the form. The “name” part is the same as the NAME= field in the HTML code that defines the field, and the “value” part is the data the user entered.

NOTE: Before building up your query string, you should call URLEncode on each “value” string, just in case there are spaces or punctuation marks in it. The CGI script will get very confused if it’s not urlencoded first.

Example:

AddExtender("WWWSK32I.DLL")

See Also:

HTTPGetPath, HTTPGetServer, HTTPRecvText, URLEncode


HTTPRecvText

Downloads a text file from a web server.

Syntax:

HTTPRecvText(server, path, maxsize, hdr mode)

Parameters:

(s) server	The web server to get the file from.

(s) path	The pathname of the file on the server's computer.

(i) maxsize	Max size to receive.

(i) hdr mode	@TRUE if you want to receive the HTTP header lines as well as
the data, else @FALSE.

Returns:

(s)	The file you requested, optionally with the HTTP header lines at
the beginning.

SGetLastErr():

@SOK	Recieved the file OK.

@SErrNoConn	Server closed the connection before sending anything back.

Other errors from SOpen, SConnect, SSendLine, or SRecvLine.

Each HTTP reply starts with several lines of header information and a blank line before the requested data.

A file that’s received from a web server is usually an HTML web page, but it could be any file you get when you click on a link in a web browser.

Example:

URL="http://www.windowware.com/"

serv=HTTPGetServer(URl, "")

path=HTTPGetpath(URl, "")

a=HTTPRecvText(serv, path, 1000, 0)

message("File Contents are", a)

See Also:

HTTPGetAnchor, HTTPGetDir, HTTPGetFile, HTTPGetPath, HTTPGetServer, HTTPPostQuery, URLDecode, URLGetScheme


URLDecode

Takes a string in URL encoded format and converts it to plain text.

Syntax:

URLDecode (data)

Parameters:

(s) data	The string to decode.

Returns:

(s)	The string in plain text.

Example:

sTitle = "URLEncoding/Decoding"

AddExtender("WWWSK32I.DLL")

sPlain = ""

while (@TRUE)

        sPlain = AskLine (sTitle, "Enter the plain string:", sPlain)

        sEncoded = URLEncode (sPlain)

        sMsg = strcat ("Original string:   ", sPlain, @CRLF, "urlencoded string: ", sEncoded)

        Message (sTitle, sMsg)

        sEncoded = AskLine (sTitle, "Enter the encoded string:", sEncoded)

        sPlain = URLDecode (sEncoded)

        sMsg = strcat ("Encoded string: ", sEncoded, @CRLF, "Plain string:   ", sPlain)

        Message (sTitle, sMsg)

endwhile

See Also:

URLEncode


URLEncode

Takes a plain text string and converts it to URL encoded format.

Syntax:

URLEncode (data)

Parameters:

(s) data	The string to encode.

Returns:

(s)	The string in urlencoded form.

When a web client (a browser for instance) sends a request to a CGI script running on a web server, the data is sent to the CGI program appended onto the end of a URL. In this format, there can’t be any spaces or control characters in the data that’s sent.

Because of this, you have to “urlencode” the data values you send. In urlencoding, spaces are turned into “+”s, and punctuation marks or control characters are “escaped” into a “%” and two hex digits.

If you want to simulate a user filling out a web form, you must call URLEncode for each data value you’re including in the query string.

Example:

AddExtender("WWWSK32I.DLL")

sField1 = “My name”

sField2 = “My address, Apt. #c”

sField1 = URLEncode (sField1)

sField2 = URLEncode (sField2)

sQuery = “name=%sField1%&addr1=%sField2%”

At this point, sQuery would be 	“name=My+name&addr1=My+address%2C+Apt.+%23c”

sPage = HTTPPostQuery (“www.someserver.com”,“\cgi-bin\formproc”,
sQuery, 32767, @FALSE)

See Also:

URLDecode


URLGetScheme

Extracts the scheme from a URL.

Syntax:

URLGetScheme (URL, scheme)

Parameters:

(s) URL	The URL to parse. This can be a fully-qualified URL or relative.

(s) scheme	The default scheme to use.

Returns:

(s)	The URL’s scheme if found, else the default.

A fully-qualified URL comes in this syntax:

<scheme>:<details>

ex.:	http://www.windowware.com/index.html
ftp://ftp.windowware.com/WinBatch/wbt32i.dll
mailto:morriew@windowware.com

Each scheme has its own syntax for the details part.

Example:

url="http://www.windowware.com/index.html"

url2="ftp://ftp.windowware.com/WinBatch/wbt32i.dll"

a=URLGetScheme(url, "")

b=URLGetScheme(url2, "")

message("The schemes are", "%a% - %URL% %@CRLF% %B% - %url2%")

See Also:

URLEncode, URLDecode


SMTPSendText

Sends a text-only email message.

Syntax:

SMTPSendText (server, from, to, subject, text)

Parameters:

(s) server	A mail server; i.e. "mail.nerdsrus.com".

(s) from	A mail address; i.e. “myname@nerdsrus.com”.

(s) to	The recipient's mail address.

(s) subject	A subject line or a null string, ("").

(s) text	The message body.

Returns:

(number)	@TRUE if the message was sent, or @FALSE if an error was
received or the user hit Ctrl+Break.

SGetLastErr():

@SOK	Sent the message OK.

Other errors from SOpen, SConnect, SSendLine, or SRecvLine.

Example:

AddExtender("wwwsk32i.dll ")

mserver  = "mail.windowware.com"

whofrom = "ralph@windowware.com"

whoto    = "support@windowware.com"

dasubj   = "Greetings"

damsg       = "Have you noticed... it's raining."

rc = SMTPSendText (mserver, whofrom, whoto, dasubj, damsg)

Message("Mail sent  Return code is",rc)

See Also:

P3xxx commands


P3Close

Closes a POP3 session.

Syntax:

P3Close (handle)

Parameters:

(i) handle	The POP3 session handle you got from P3Open.

Returns:

(i)	@TRUE if the session was closed, or @FALSE if an error was
received.

SGetLastErr():

@SOK	Disconnected OK.

Example:

AddExtender("WWWSK32I.DLL")

user="techinfo"

pswd="grace"

handle=p3Open("mail.windowware.com", user, pswd)

count=p3Count(handle)

message("messages", "There are %count% messages waiting to be read.")

P3Close(handle)

SeeAlso:

P3Count, P3Delete, P3Open


P3Count

Counts the number of messages in your mailbox.

Syntax:

P3Count (handle)

Parameters:

(i) handle	The POP3 session handle you got from P3Open.

Returns:

(i)	The number of unread mail messages in the inbox, or 0 if there
was an error.

Use SGetLastErr() to verify the return value.

SGetLastErr():

@SOK	Got the information OK.

@P3ErrReply	The mail server sent back an error message instead of the message count.

Other error codes from SSendLine, SRecvLine.

Example:

AddExtender("WWWSK32I.DLL")

user="techinfo"

pswd="grace"

handle=p3Open("mail.windowware.com", user, pswd)

count=p3Count(handle)

for i = 1 to count

        a=P3RecvText (handle, i, 37257)

        dafile=FileOpen("c:\temp\msg.txt", "append")

        FileWrite(dafile, a)

        FileClose(dafile)

next

P3Close(handle)

SeeAlso:

P3GetReply, P3Open, P3Peek, P3RecvText


P3Delete

Deletes a message from your mailbox.

Syntax:

P3Delete (handle, message)

Parameters:

(i) handle	The POP3 session handle you got from P3Open.

(i) message	The number of the message in the mailbox to delete. (Message
numbers start at 1.)

Returns:

(number)	@TRUE if the message was deleted, else @FALSE if an error
occurred.

SGetLastErr():

@SOK	Deleted it OK.

Other error codes from SSendLine, SRecvLine.

Example:

AddExtender("WWWSK32I.DLL")

user="techinfo"

pswd="grace"

handle=p3Open("mail.windowware.com", user, pswd)

count=p3Count(handle)

for i = 1 to count

        a=P3RecvText (handle, i, 37257)

        dafile=FileOpen("c:\temp\msg.txt", "append")

        FileWrite(dafile, a)

        FileClose(dafile)

        p3Delete(handle, a)

next

P3Close(handle)

SeeAlso:

P3Close


P3GetReply

Returns the description from the last POP3 reply code.

Syntax:

P3GetReply ()

Returns:

() 	The POP3 reply received after the last command.

A POP3 server response to a request starts with either +OK or -ERR and generally includes a description at the end. P3GetReply returns the description.

Use SGetLastErr() to verify whether the return value was an -ERR reply.

Example:

AddExtender("WWWSK32I.DLL")

user="wilma"

pswd="zebog"

handle=p3Open("mail.windowware.com", user, pswd)

count=p3Count(handle)

for i = 1 to count

        a=P3RecvText(handle, i, 37257)

        damsg=P3Peek(handle, 1, 1000)

next

P3Close(handle)

reply=P3GetReply ()

message("reply", reply)

See Also:

SGetLastErr


P3Open

Opens a session with a POP3 mail server.

Syntax:

P3Open (server, user, password)

Parameters:

(s) server	A mail server, usually in the form of "mail.yourisp.com".

(s) user	A user name.

(s) password	A password, if any. (The password required at time of login to
the network.)

Returns:

(number)	@TRUE if the session was successfully opened, else @FALSE
upon an error or password failure.

SGetLastErr():

@SOK	Connected OK.

@SErrParam	No POP3 server specified.

@P3ErrReply	POP3 server sent back an error reply to one of our login commands.

Other error codes from SOpen, SConnect, SSendLine, SRecvLine.

Example:

AddExtender("WWWSK32I.DLL")

user="techinfo"

pswd="grace"

handle=p3Open("mail.windowware.com", user, pswd)

count=p3Count(handle)

message("messages", "There are %count% messages waiting to be read.")

P3Close(handle)

SeeAlso:

P3Close, P3Count, P3GetReply, P3Peek, P3RecvText


P3Peek

Reads the header & first few lines of a message in your mailbox.

Syntax:

P3Peek (handle, message, lines)

Parameters:

(i) handle	The POP3 session handle you got from P3Open.

(i) message	The number of the message in the mailbox to be read.
(Message numbers start at 1.)

(i) lines	Number of lines to retrieve.

Returns:

(s)	The truncated message with the header lines plus the number of
specified lines of the body.

SGetLastErr():

@SOK	Connected OK.

@SErrParam	No mail server, from, or to address specified.

Other error codes from SSendLine, SRecvLine.

Example:

AddExtender("WWWSK32I.DLL")

user="wilma"

pswd="zebog"

handle=p3Open("mail.windowware.com", user, pswd)

count=p3Count(handle)

for i = 1 to count

        a=P3RecvText (handle, i, 37257)

        damsg=P3Peek(handle, 1, 1000)

        message("count %count%", damsg)

next

P3Close(handle)

SeeAlso:

P3GetReply, P3Open, P3RecvText


P3RecvText

Downloads a message from your mailbox.

Syntax:

P3RecvText (handle, message, maxsize)

Parameters:

(i) handle	The POP3 session handle you got from P3Open.

(i) message	The number of the message in the mailbox to download.
(Message numbers start at 1.)

(i) maxsize	The maximum size to receive. (Suggested value - 32767.  This
value cannot exceed the total value allowed for all strings within
a given WIL script, 65535)

Returns:

(s)	The text of the message upon success, or a NULL string if the
text was not received.

SGetLastErr():

@SOK	Received it OK.

Other error codes from SRecvLine.

Example:

AddExtender("WWWSK32I.DLL")

user="techinfo"

pswd="grace"

handle=p3Open("mail.windowware.com", user, pswd)

count=p3Count(handle)

for i = 1 to count

        a=P3RecvText (handle, i, 37257)

        dafile=FileOpen("c:\temp\msg.txt", "append")

        FileWrite(dafile, a)

        FileClose(dafile)

next

P3Close(handle)

SeeAlso:

P3Close, P3Count, P3Delete, P3GetReply, P3Open, P3Peek, P3RecvText


SByteOrder16
SByteOrder32

Converts a 16- or 32-bit binary number from network byte order to the PC’s byte order & vice versa.

Syntax:

SByteOrder16 (number, direction mode)
SByteOrder32 (number, direction mode)

Parameters:

(i) number	The binary number to translate.

(i) direction mode	@SNet2PC - translates a number received from the net to the
PC’s byte order.
@SPC2Net - translates a number from the PC’s byte order to
the network’s.

Returns:

(i)	The translated number.

When only sending or receiving a value, it is not necessary to call these functions;
SSendNum8, SSendNum16, SSendNum32, SRecvNum8, SRecvNum16, or SRecvNum32. They all do the translation for you.

Example:

AddExtender("WWWSK32I.DLL")

SeeAlso:

Sockets Commands


SClose

Closes a socket.

Syntax:

SClose (socket)

Parameters:

(i) socket	The socket to close.

Returns:

(i)	@TRUE if the socket was closed successfully, else @FALSE.

SGetLastErr():

@SOK	Closed the socket OK.

10000..11004	See Winsock Error Codes.

Example:

AddExtender("WWWSK32I.DLL")

<Open a socket & connect it to something>

nRet = SSendLine (hSocket, sCmd)

if (nRet==@FALSE)

Message (sTitle, “Error sending data!”)

goto Cancel

endif

sData = SRecvLine (hSocket)

nErr = SGetLastErr()

if (nRet<>@SOK)

Message (sTitle, “Error receiving data!”)

goto Cancel

endif

<Do something with sData>

; We’re through with the socket, there was an error, or user

; hit Ctrl+Break during the operation. Just close it...

:Cancel

SClose (hSocket)

exit

See Also:

SOpen


SConnect

Connects a socket to an Internet host & network service (i.e. “ftp”).

Syntax:

SConnect (socket, hostaddr, service)

Parameters:

(i) socket	A socket to be connected.

(s) hostaddr	The host to be connected. Either a symbolic host name like
“myserv.com”, or a dotted-decimal IP address like “192.123.456.1”.

(s) service	The name of the service to connect the socket to or the
service’s port number (ex: “time”, or “37”).
NOTE: To connect the socket to an http port, you must specify
its port # (“80”) directly.

Returns:

(i)	@TRUE if the connections were made, else @FALSE.

SGetLastErr():

@SOK	Connected OK.

@SCancel	User hit Cancel in the “Connect To” dialog, or unknown host name.

@SErrParam	Unknown socket # specified.

@SErrService	Unknown service name specified.

@SErrIPAddr	Invalid IP dotted-decimal address specified.

@SErrHostName	Unknown host name specified.

@SErrNoConn	Host computer refused to connect, possibly because it doesn’t
support the requested service.

@SErrBusy	Host computer too busy to connect.

10000..11004	See Winsock Error Codes.

If you’re not already hooked up to an Internet Service Provider, this will bring up the “Connect To” dialog. To dial without human intervention, use the DUNConnect command.

Example:

AddExtender("WWWSK32I.DLL")

See Also:

SClose, DUNConnect, SOpen


SGetLastErr

Gets the last error generated by a Winsock extender function.

Syntax:

SGetLastErr ()

Returns:

(i)	The result of the last Sxxx function. (See the specific function description).

The following is a general description of the errors which may be returned by SGetLastErr.  For a specific error description see the documentation of the function which returned the error.

@SOK	Performed the function satisfactorily.

@SErrNoConn	The connection failed or has already been closed.

@P3ErrReply	POP3 server sent back an error reply to one of our login

@SErrParam	Function dependent parameter error.  See the function's documentation.

@SCancel	User hit Cancel in the “Connect To” dialog, or unknown host name.

@SErrService	Unknown service name specified.

@SErrIPAddr	Invalid IP dotted-decimal address specified.

@SErrHostName	Unknown host name specified.

@SErrBusy	Host computer too busy to connect.

@SErrWinsock	Couldn’t initialize Winsock. WIL needs Winsock v1.1 or higher.

@SErrSocket	Error creating the socket.

@SAlready	The dial-up is already connected. The return value identifies the existing connection.

@SErrNotFound	Unknown host name specified.

600..750	Remote Access Service error code (See Dial-Up Networking return codes).

10000..11004	Winsock error code

Example:

AddExtender("WWWSK32I.DLL")

<Open a socket & connect it to something>

nRet = SSendLine (hSocket, sCmd)

if (nRet==@FALSE)

Message (sTitle, “Error sending data!”)

goto Cancel

endif

sData = SRecvLine (hSocket)

nErr = SGetLastErr()

if (nRet<>@SOK)

Message (sTitle, “Error receiving data!”)

goto Cancel

endif

<Do something with sData>

; We’re through with the socket, there was an error, or user

; hit Ctrl+Break during the operation. Just close it...

:Cancel

SClose (hSocket)

exit

See Also:

P3GetReply


SOK2Recv

Checks the status of the socket to see if there is data waiting to be read.

Syntax:

SOK2Recv (socket, size)

Parameters:

(i) socket	A handle specifying the socket to check.

(i) size	The number of bytes to receive.

Returns:

(i)	@TRUE if an SRecvXXX command could be carried out without
waiting, else @FALSE if the WIL script would have to wait first.

SGetLastErr():

@SOK	Determined the status OK.

10000..11004	See Winsock Error Codes.

The SRecvXXX functions all wait until the computer actually receives all the data the function is requesting. SOK2Recv determines if there is currently enough data in the receive queue to return immediately.

Example:

AddExtender("WWWSK32I.DLL")

See Also:

SOpen, SConnect, SRecvXXX


SOK2Send

Checks to see if data can be sent without waiting.

Syntax:

SOK2Send (socket)

Parameters:

(i) socket	A handle specifying the socket to check.

Returns:

(i)	@TRUE if SSendXXX command could be carried out without
waiting, else @FALSE if the WIL script would have to wait.

SGetLastErr():

@SOK	Determined the status OK.

The SSendXXX functions all wait until there is enough space available in this computer’s send buffer to put the data we’re sending. This function tells us if there is currently enough space in the send queue to do it immediately.

Example:

AddExtender("WWWSK32I.DLL")

See Also:

SOpen, SConnect, SSendXXX


SOpen

Creates a new stream (TCP) socket.

Syntax:

socket = SOpen ()

Returns:

(i)	A handle specifying the socket that was created, or @FALSE if
there was an error.

SGetLastErr():

@SOK	The socket was created successfully.

@SErrWinsock	Couldn’t initialize Winsock. WIL needs Winsock v1.1 or higher.

@SErrSocket	Error creating the socket.

When sending & receiving data to/from a remote host, the script cannot control how fast the process runs. The server could be slow in responding to the requests for data, or the data could be sent out faster than the network can process it.  In either case, the Winsock send buffer may fill up, forcing the socket to wait.

Standard Winsock programming recognizes two kinds of sockets: Blocking and non-blocking. A socket created as "blocking" will wait before sending or receiveing calls until all the data can be sent/received.  This makes for by far the simplest code. However, if the server stops responding or the network seems hung up, the user will be unable to use a Ctrl+Break to “wake up” the application.

On the other hand, when a “non-blocking” socket is unable to send or receive all the data, it returns immediately with an error code telling the program to wait a bit. The program is expected to either enter a retry loop until the send or receive is successful or to set up an event notification complete with callback function or dummy hidden windows.  Windows messages reporting on the change in status will be received by the event notification.

WIL sockets are “psuedo-blocking”, and give the best of both worlds. As far as the script is concerned, any socket you create is a blocking socket.  Simply call SRecvXXX or SSendXXX. When they return, they’ve either processed the data or encountered an error. The user will be able recover from a network hang up by using Ctrl+Break.

Example:

AddExtender("WWWSK32I.DLL")

<Open a socket & connect it to something>

nRet = SSendLine (hSocket, sCmd)

if (nRet==@FALSE)

Message (sTitle, “Error sending data!”)

goto Cancel

endif

sData = SRecvLine (hSocket)

nErr = SGetLastErr()

if (nRet<>@SOK)

Message (sTitle, “Error receiving data!”)

goto Cancel

endif

<Do something with sData>

; We’re through with the socket, there was an error, or user

; hit Ctrl+Break during the operation. Just close it...

:Cancel

SClose (hSocket)

exit

See Also:

SConnect, SClose


SRecvBinary

Gets binary data from a socket into a binary data type created with BinaryAlloc.

Syntax:

SRecvBinary (socket, blob, size)

Parameters:

(i) socket	A handle specifying the socket to get data from.

(i) blob	A handle specifying the binary object that receives the data.

(i) size	The number of characters to receive.

Returns:

(i)	@TRUE if the data was received OK, else @FALSE if there was
an error or not enough data ever came in.

SGetLastErr():

@SOK	Received the data OK.

@SErrNoConn	The server has already closed the connection.

10000..11004	See Winsock Error Codes.

Example:

AddExtender("WWWSK32I.DLL")

See Also:

SOpen, SConnect, SSendBinary, SRecvLine, SRecvNum8/16/32


SRecvLine

Gets a line of text from a socket, up to the first CR/LF.

Syntax:

SRecvLine (socket, maxsize)

Parameters:

(i) socket	A handle specifying the socket to get data from.

(i) maxsize	The maximum characters to receive in one line. (This value
must be less than 65535, which is the total allowed for all strings
in your WIL script. A good value would be 32767.)

Returns:

(s)	The next line of text in the receive buffer, with its trailing CR/LF stripped off.

SGetLastErr():

@SOK	Received the data OK.

@SErrParam	Max chars requested > 65535.

@SErrNoConn	The server has already closed the connection.

10000..11004	See Winsock Error Codes.

Example:

AddExtender("WWWSK32I.DLL")

<Open a socket & connect it to something>

nRet = SSendLine (hSocket, sCmd)

if (nRet==@FALSE)

Message (sTitle, “Error sending data!”)

goto Cancel

endif

sData = SRecvLine (hSocket)

nErr = SGetLastErr()

if (nRet<>@SOK)

Message (sTitle, “Error receiving data!”)

goto Cancel

endif

<Do something with sData>

; We’re through with the socket, there was an error, or user

; hit Ctrl+Break during the operation. Just close it...

:Cancel

SClose (hSocket)

exit

See Also:

SOpen, SConnect, SSendLine SSendString


SRecvNum8
SRecvNum16
SRecvNum32

Gets numeric data from a socket and converts the result from network byte order to PC byte order.

Syntax:

SRecvNum8 (socket)
SRecvNum16 (socket)
SRecvNum32(socket)

Parameters:

(i) socket	The socket to get data from.

Returns:

(i)	The next 1, 2, or 4 bytes of data received, expressed as a
signed 8-, 16-, or 32-bit number. (These are converted, if
necessary, from network byte order to PC byte order.)

SGetLastErr():

@SOK	Received the data OK.

@SErrNoConn	The server has already closed the connection.

10000..11004	See Winsock Error Codes.

Example:

AddExtender("WWWSK32I.DLL")

See Also:

SOpen, SConnect, SSendNum8/16/32


SSendBinary

Sends binary data to a socket.

Syntax:

SSendBinary (socket, blob, size)

Parameters:

(i) socket	A handle specifying the socket to send data to.

(i) blob	The binary object to send.

(i) size	How many bytes to send.

Returns:

(i)	@TRUE if all the data was sent OK, else @FALSE if there was
an error.

SGetLastErr():

@SOK	Sent the data OK.

10000..11004	See Winsock Error Codes.

Example:

AddExtender("WWWSK32I.DLL")

See Also:

SOpen, SConnect, SSendString, SSendNum8/16/32


SSendNum8
SSendNum16
SSendNum32

Sends an integer to a socket.

Syntax:

SSendNum8  (socket, number)
SSendNum16 (socket, number)
SSendNum32 (socket, number)

Parameters:

(i) socket	A handle specifying the socket to send data to.

(i) number	The 1-, 2-, or 4-byte number to send. (This is converted, if
necessary, from PC byte order to network byte order.)

Returns:

(i)	@TRUE if all the data was sent OK, else @FALSE if there was
an error.

SGetLastErr():

@SOK	Sent the data OK.

10000..11004	See Winsock Error Codes.

Example:

AddExtender("WWWSK32I.DLL")

See Also:

SOpen, SConnect, SSendBinary, SSendString,


SSendString SSendLine
SSendString

SSendString sends a string to a socket.

Syntax:

SSendString (socket, string)

Parameters:

(i) socket	The socket to send data to.

(s) string	The data to send.

Returns:

(i)	@TRUE if all the data was sent OK, else @FALSE if there was an error.

SGetLastErr():

@SOK	Sent the data OK.

10000..11004	See Winsock Error Codes.

Example:

AddExtender("WWWSK32I.DLL")

See Also:

SOpen, SConnect, SSendBinary, SSendNum8/16/32


SSendLine

SSendLine will first append a CR/LF on the end of the string if it isn’t already there.

Syntax:

SSendLine   (socket, string)

Parameters:

(i) socket	The socket to send data to.

(s) string	The data to send.

Returns:

(i)	@TRUE if all the data was sent OK, else @FALSE if there was an error.

SGetLastErr():

@SOK	Sent the data OK.

10000..11004	See Winsock Error Codes.

Example:

AddExtender("WWWSK32I.DLL")

<Open a socket & connect it to something>

nRet = SSendLine (hSocket, sCmd)

if (nRet==@FALSE)

Message (sTitle, “Error sending data!”)

goto Cancel

endif

sData = SRecvLine (hSocket)

nErr = SGetLastErr()

if (nRet<>@SOK)

Message (sTitle, “Error receiving data!”)

goto Cancel

endif

<Do something with sData>

; We’re through with the socket, there was an error, or user

; hit Ctrl+Break during the operation. Just close it...

:Cancel

SClose (hSocket)

exit

See Also:

SOpen, SConnect, SSendBinary, SSendNum8/16/32


FtpOpen(host name, user name, password, account, attempts)

Opens an FTP session on a remote host.

Syntax

FtpOpen(host name, user name, password, account, attempts)

Parameters

(s) host name	Name or address of an FTP server.

(s) user name	Username for FTP session.

(s) password	Password for FTP Session.

(s) account	Account for FTP Session (if applicable).

(i) attempts	Number of connection attempts to make.

Returns

(i) hSession   	a session handle for use in other ftp functions.

(s) ErrMsg 	an error message string if open was unsuccessful.

This function establishes an FTP session with a remote FTP server. In most cases the account field should be set to a null string.

Note 1:  Many servers accept "anonymous" connects.  If you wish to make an anonymous connect; set the username field to "anonymous", set the password field to your email address (or the email address of a responsible party), and set the account field to a null string  "".

Note2:   The return value of this function is >extremely< nonstandard.  Use the IsNumber function (found in the main WIL help file) to test the return value.  If the return value is indeed a number, the function established a connection. Otherwise the function failed and the return value is an explanatory error message.

Note3:   You can only have one open FTP session at a time.

Example

AddExtender("WWWSK32I.DLL")

host="ftp.windowware.com"

userid="anonymous"

pswd="support@windowware.com"

acct=""

hSession=FtpOpen(host,userid,pswd,acct,1)

if !IsNumber(hSession)

    Message("FTP Open Error",hSession)

    exit

endif

rs=FtpGet(hSession, "/wwwftp/wilson/README.TXT", "c:\temp\README.TXT", "A")

FtpClose(hSession)

Message("FtpGet returned",rs)

See Also:

FtpClose, FtpDelete


FtpClose(hSession)

Closes an FTP session.

Syntax:

FtpClose(hSession)

Parameters:

(i) hSession	FTP session handle as returned by the FtpOpen function.

Returns:

(i)     	@TRUE if successful;

@FALSE if unsuccessful.

Terminates an FTP session and closes the network connection.

Example:

AddExtender("WWWSK32I.DLL")

host="ftp.windowware.com"

userid="anonymous"

pswd="support@windowware.com"

acct=""

hSession=FtpOpen(host,userid,pswd,acct,1)

if !IsNumber(hSession)

    Message("FTP Open Error",hSession)

    exit

endif

rs=FtpGet(hSession, "/wwwftp/wilson/README.TXT", "c:\temp\README.TXT", "A")

FtpClose(hSession)

Message("FtpGet returned",rs)

See Also:

FtpOpen, FtpDelete


FtpGet(hSession, remote-file, local-file, transfer-type)

Copies a file from a remote FTP server to the local machine.

Syntax:

FtpGet(hSession, remote-file, local-file, transfer-type)

Parameters:

(i) hSession	FTP session handle as returned by the FtpOpen function.

(s) remote-file	Filename on remote system

(s) local-file	Filename on local system to write file to

(s) transfer-type	"A" (ASCII) or "B" (Binary / Image)

Returns:

(s)	a NULL string ("") if the file was copied;
an error message if the copy failed.

This function will retrieve a file from a remote FTP server and copy it to the local machine using the filename specified in the local-file parameter.

Example:

AddExtender("WWWSK32I.DLL")

host="ftp.windowware.com"

userid="anonymous"

pswd="support@windowware.com"

acct=""

hSession=FtpOpen(host,userid,pswd,acct,1)

if !IsNumber(hSession)

    Message("FTP Open Error",hSession)

    exit

endif

rs=FtpGet(hSession,"/wwwftp/wilson/README.TXT","c:\temp\README.TXT","A")

FtpClose(hSession)

Message("FtpGet returned",rs)

See Also:

FtpPut, FtpList, FtpChDir


FtpPut(hSession, local-file, remote-file, transfer-type)

Sends a file from the local machine to a remote FTP server.

Syntax:

FtpPut(hSession, local-file, remote-file, transfer-type)

Parameters:

(i) hSession	FTP session handle as returned by the FtpOpen function.

(s) local-file	Filename on local system of file to send.

(s) remote-file	Filename on remote system to write to.

(s) transfer-type	"A" (ASCII) or "B" (Binary / Image).

Returns:

(s)	a NULL string ("") if the file was copied;
an error message if the copy failed.

This function will copy a file from the local machine and send it to a remote FTP server.

Note:  Many FTP servers permit "anonymous" reading of files, but very few permit anonymous writing of files.

Example:

AddExtender("WWWSK32I.DLL")

host="ftp.microsoft.com"

userid="bigbird"

pswd="K832dmj7w0Wk"

acct="TechServices"

hSession=FtpOpen(host,userid,pswd,acct,1)

if !IsNumber(hSession)

    Message("FTP Open Error",hSession)

    exit

endif

rs=FtpPut(hSession, "C:\temp\readme.txt", "\pub\README.TXT", "A")

FtpClose(hSession)

Message("FtpPut returned",rs)

See Also:

FtpGet, FtpList, FtpChDir,


FtpList(hSession, remote-path, local-file)

Obtains a directory listing from a remote FTP server.

Syntax:

FtpList(hSession, remote-path, local-file)

Parameters:

(i) hSession	FTP session handle as returned by the FtpOpen function.

(s) remote-path 	Directory or file name on remote system.

(s) local-file	Filename to write directory list to.

Returns:

(s)	a NULL string ("") if the listing was obtained;
an error message if FtpList failed.

Fetches a directory listing from the FTP server.

A remote-path of "" will fetch a directory listing of the current directory on the remote system.

Example:

AddExtender("WWWSK32I.DLL")

host="www.windowware.com"

userid="anonymous"

pswd="support@windowware.com"

acct=""

ftp=FtpOpen(host,userid,pswd,acct,1)

if !IsNumber(ftp)

    Message("FTP Open Error",ftp)

    exit

endif

list=FtpList(ftp,"/wwwftp/wilson","ftp.tmp")

FtpClose(ftp)

RunWait("notepad.exe","ftp.tmp")

See Also:

FtpGet, FtpChDir


FtpChDir(hSession, remote-path)

Changes the current directory on a remote FTP server.

Syntax:

FtpChDir(hSession, remote-path)

Parameters:

(i) hSession	FTP session handle as returned by the FtpOpen function.

(s) remote-path	Directory on remote system.

Returns:

(s)	NULL string ("") if successful;

error message if unsuccessful.

Changes the current (default) directory for the current FTP session on the remote FTP server.

Example:

AddExtender("WWWSK32I.DLL")

host="www.windowware.com"

userid="anonymous"

pswd="support@windowware.com"

acct=""

ftp=FtpOpen(host,userid,pswd,acct,1)

if !IsNumber(ftp)

    Message("FTP Open Error",ftp)

    exit

endif

;Note FtpGet WITH chdir

FtpChdir(ftp,"/wwwftp/wilson")

rs=FtpGet(ftp, "README.TXT", "c:\temp\README.TXT", "A")

;note FtpGet WITHOUT chdir

rs=FtpGet(ftp, "/wwwftp/wilson/README.TXT", "c:\temp\README.TXT", "A")

FtpClose(ftp)

See Also:

FtpGet, FtpList


FtpQuote(hSession, command)

Sends a command string to a remote FTP server.

Syntax:

FtpQuote(hSession, command)

Parameters:

(i) hSession	FTP session handle as returned by the FtpOpen function

(s) command	Command to send to remote system

Returns:

(s)	reply string.

This sends a command string (also known as a "Quote" command) to a remote FTP server, and returns the reply string from the server.

Example:

AddExtender("WWWSK32I.DLL")

host="www.windowware.com"

userid="anonymous"

pswd="support@windowware.com"

acct=""

ftp=FtpOpen(host,userid,pswd,acct,1)

if !IsNumber(ftp)

    Message("FTP Open Error",ftp)

    exit

endif

; Sends PWD command (print working directory)

rs=FtpQuote(ftp, "PWD")

FtpClose(ftp)

Message("PWD", rs)

See Also:

FtpPut


FtpRename(hSession, remote-oldname, remote-newname)

Renames a file on a remote FTP server.

Syntax:

FtpRename(hSession, remote-oldname, remote-newname)

Parameters:

(i) hSession	FTP session handle as returned by the FtpOpen function.

(s) remote-oldname	source filename on remote system.

(s) remote-newname	target filename on remote system.

Returns:

(s)	Returns a NULL string ("") if the file was renamed,
or an error message if the rename failed.

Example:

AddExtender("WWWSK32I.DLL")

See Also:

FtpChDir


FtpDelete(hSession, remote-file)

Deletes a file from a remote FTP server.

Syntax:

FtpDelete(hSession, remote-file)

Parameters:

(i) hSession	FTP session handle as returned by the FtpOpen function.

(s) remote-file	Filename on remote system.

Returns:

(s)	Returns a NULL string ("") if the file was deleted,
or an error message if the delete failed.

Example:

AddExtender("WWWSK32I.DLL")

See Also:

FtpClose


APPENDIX A: Winsock error codes
Winsock Error Codes

10004 WSAEINTR 10009 WSAEBADF 10013 WSAEACCES 10014 WSAEFAULT 10022 WSAEINVAL 10024 WSAEMFILE 10035 WSAEWOULDBLOCK (SSend/SRecv - Gets translated to @SErrMustWait) 10036 WSAEINPROGRESS 10037 WSAEALREADY 10038 WSAENOTSOCK (SConnect - gets translated to @SErrSocket) 10039 WSAEDESTADDRREQ 10040 WSAEMSGSIZE 10041 WSAEPROTOTYPE 10042 WSAENOPROTOOPT 10043 WSAEPROTONOSUPPORT 10044 WSAESOCKTNOSUPPORT 10045 WSAEOPNOTSUPP 10046 WSAEPFNOSUPPORT 10047 WSAEAFNOSUPPORT 10048 WSAEADDRINUSE 10049 WSAEADDRNOTAVAIL 10050 WSAENETDOWN 10051 WSAENETUNREACH 10052 WSAENETRESET (SConnect - gets translated to @SErrNoConn) 10053 WSAECONNABORTED (SConnect - gets translated to @SErrNoConn) 10054 WSAECONNRESET 10055 WSAENOBUFS 10056 WSAEISCONN 10057 WSAENOTCONN 10058 WSAESHUTDOWN 10059 WSAETOOMANYREFS 10060 WSAETIMEDOUT (SConnect - gets translated to @SErrNoConn) 10061 WSAECONNREFUSED (SConnect - gets translated to @SErrBusy) 10062 WSAELOOP 10063 WSAENAMETOOLONG 10064 WSAEHOSTDOWN 10065 WSAEHOSTUNREACH 10066 WSAENOTEMPTY 10067 WSAEPROCLIM 10068 WSAEUSERS 10069 WSAEDQUOT 10070 WSAESTALE 10071 WSAEREMOTE 10091 WSASYSNOTREADY 10092 WSAVERNOTSUPPORTED 10093 WSANOTINITIALISED 10101 WSAEDISCON 11001 WSAHOST_NOT_FOUND 11002 WSATRY_AGAIN 11003 WSANO_RECOVERY 11004 WSANO_DATA (SConnect - gets translated to @SCancel)	Winsock Command Reference Dial-Up Networking return codes


APPENDIX. B: Dial-Up Networking return codes

Dial-Up Networking return codes

600 PENDING 601 ERROR_INVALID_PORT_HANDLE 602 ERROR_PORT_ALREADY_OPEN (DUNConnect - becomes @SAlready) 603 ERROR_BUFFER_TOO_SMALL (User has > 16 Dialups defined) 604 ERROR_WRONG_INFO_SPECIFIED 605 ERROR_CANNOT_SET_PORT_INFO 606 ERROR_PORT_NOT_CONNECTED 607 ERROR_EVENT_INVALID 608 ERROR_DEVICE_DOES_NOT_EXIST 609 ERROR_DEVICETYPE_DOES_NOT_EXIST 610 ERROR_BUFFER_INVALID 611 ERROR_ROUTE_NOT_AVAILABLE 612 ERROR_ROUTE_NOT_ALLOCATED 613 ERROR_INVALID_COMPRESSION_SPECIFIED 614 ERROR_OUT_OF_BUFFERS 615 ERROR_PORT_NOT_FOUND 616 ERROR_ASYNC_REQUEST_PENDING 617 ERROR_ALREADY_DISCONNECTING 618 ERROR_PORT_NOT_OPEN 619 ERROR_PORT_DISCONNECTED 620 ERROR_NO_ENDPOINTS 621 ERROR_CANNOT_OPEN_PHONEBOOK 622 ERROR_CANNOT_LOAD_PHONEBOOK 623 ERROR_CANNOT_FIND_PHONEBOOK_ENTRY (DUNConnect - becomes @SErrNotFound) 624 ERROR_CANNOT_WRITE_PHONEBOOK 625 ERROR_CORRUPT_PHONEBOOK 626 ERROR_CANNOT_LOAD_STRING 627 ERROR_KEY_NOT_FOUND 628 ERROR_DISCONNECTION 629 ERROR_REMOTE_DISCONNECTION 630 ERROR_HARDWARE_FAILURE 631 ERROR_USER_DISCONNECTION 632 ERROR_INVALID_SIZE 633 ERROR_PORT_NOT_AVAILABLE 634 ERROR_CANNOT_PROJECT_CLIENT 635 ERROR_UNKNOWN 636 ERROR_WRONG_DEVICE_ATTACHED 637 ERROR_BAD_STRING 638 ERROR_REQUEST_TIMEOUT 639 ERROR_CANNOT_GET_LANA 640 ERROR_NETBIOS_ERROR 641 ERROR_SERVER_OUT_OF_RESOURCES 642 ERROR_NAME_EXISTS_ON_NET 643 ERROR_SERVER_GENERAL_NET_FAILURE 644 WARNING_MSG_ALIAS_NOT_ADDED 645 ERROR_AUTH_INTERNAL 646 ERROR_RESTRICTED_LOGON_HOURS 647 ERROR_ACCT_DISABLED 648 ERROR_PASSWD_EXPIRED 649 ERROR_NO_DIALIN_PERMISSION 650 ERROR_SERVER_NOT_RESPONDING 651 ERROR_FROM_DEVICE 652 ERROR_UNRECOGNIZED_RESPONSE 653 ERROR_MACRO_NOT_FOUND 654 ERROR_MACRO_NOT_DEFINED 655 ERROR_MESSAGE_MACRO_NOT_FOUND 656 ERROR_DEFAULTOFF_MACRO_NOT_FOUND 657 ERROR_FILE_COULD_NOT_BE_OPENED 658 ERROR_DEVICENAME_TOO_LONG 659 ERROR_DEVICENAME_NOT_FOUND 660 ERROR_NO_RESPONSES 661 ERROR_NO_COMMAND_FOUND 662 ERROR_WRONG_KEY_SPECIFIED 663 ERROR_UNKNOWN_DEVICE_TYPE 664 ERROR_ALLOCATING_MEMORY 665 ERROR_PORT_NOT_CONFIGURED 666 ERROR_DEVICE_NOT_READY 667 ERROR_READING_INI_FILE 668 ERROR_NO_CONNECTION 669 ERROR_BAD_USAGE_IN_INI_FILE 670 ERROR_READING_SECTIONNAME 671 ERROR_READING_DEVICETYPE 672 ERROR_READING_DEVICENAME 673 ERROR_READING_USAGE 674 ERROR_READING_MAXCONNECTBPS 675 ERROR_READING_MAXCARRIERBPS 676 ERROR_LINE_BUSY 677 ERROR_VOICE_ANSWER 678 ERROR_NO_ANSWER 679 ERROR_NO_CARRIER 680 ERROR_NO_DIALTONE 681 ERROR_IN_COMMAND 682 ERROR_WRITING_SECTIONNAME 683 ERROR_WRITING_DEVICETYPE 684 ERROR_WRITING_DEVICENAME 685 ERROR_WRITING_MAXCONNECTBPS 686 ERROR_WRITING_MAXCARRIERBPS 687 ERROR_WRITING_USAGE 688 ERROR_WRITING_DEFAULTOFF 689 ERROR_READING_DEFAULTOFF 690 ERROR_EMPTY_INI_FILE 691 ERROR_AUTHENTICATION_FAILURE 692 ERROR_PORT_OR_DEVICE 693 ERROR_NOT_BINARY_MACRO 694 ERROR_DCB_NOT_FOUND 695 ERROR_STATE_MACHINES_NOT_STARTED 696 ERROR_STATE_MACHINES_ALREADY_STARTED 697 ERROR_PARTIAL_RESPONSE_LOOPING 698 ERROR_UNKNOWN_RESPONSE_KEY 699 ERROR_RECV_BUF_FULL 700 ERROR_CMD_TOO_LONG 701 ERROR_UNSUPPORTED_BPS 702 ERROR_UNEXPECTED_RESPONSE 703 ERROR_INTERACTIVE_MODE 704 ERROR_BAD_CALLBACK_NUMBER 705 ERROR_INVALID_AUTH_STATE 706 ERROR_WRITING_INITBPS 707 ERROR_X25_DIAGNOSTIC 708 ERROR_ACCT_EXPIRED 709 ERROR_CHANGING_PASSWORD 710 ERROR_OVERRUN 711 ERROR_RASMAN_CANNOT_INITIALIZE 712 ERROR_BIPLEX_PORT_NOT_AVAILABLE 713 ERROR_NO_ACTIVE_ISDN_LINES 714 ERROR_NO_ISDN_CHANNELS_AVAILABLE 715 ERROR_TOO_MANY_LINE_ERRORS 716 ERROR_IP_CONFIGURATION 717 ERROR_NO_IP_ADDRESSES 718 ERROR_PPP_TIMEOUT 719 ERROR_PPP_REMOTE_TERMINATED 720 ERROR_PPP_NO_PROTOCOLS_CONFIGURED 721 ERROR_PPP_NO_RESPONSE 722 ERROR_PPP_INVALID_PACKET 723 ERROR_PHONE_NUMBER_TOO_LONG 724 ERROR_IPXCP_NO_DIALOUT_CONFIGURED 725 ERROR_IPXCP_NO_DIALIN_CONFIGURED 726 ERROR_IPXCP_DIALOUT_ALREADY_ACTIVE 727 ERROR_ACCESSING_TCPCFGDLL 728 ERROR_NO_IP_RAS_ADAPTER 729 ERROR_SLIP_REQUIRES_IP 730 ERROR_PROJECTION_NOT_COMPLETE 731 ERROR_PROTOCOL_NOT_CONFIGURED 732 ERROR_PPP_NOT_CONVERGING 733 ERROR_PPP_CP_REJECTED 734 ERROR_PPP_LCP_TERMINATED 735 ERROR_PPP_REQUIRED_ADDRESS_REJECTED 736 ERROR_PPP_NCP_TERMINATED 737 ERROR_PPP_LOOPBACK_DETECTED 738 ERROR_PPP_NO_ADDRESS_ASSIGNED 739 ERROR_CANNOT_USE_LOGON_CREDENTIALS 740 ERROR_TAPI_CONFIGURATION 741 ERROR_NO_LOCAL_ENCRYPTION 742 ERROR_NO_REMOTE_ENCRYPTION 743 ERROR_REMOTE_REQUIRES_ENCRYPTION 744 ERROR_IPXCP_NET_NUMBER_CONFLICT 745 ERROR_INVALID_SMM 746 ERROR_SMM_UNINITIALIZED 747 ERROR_NO_MAC_FOR_PORT 748 ERROR_SMM_TIMEOUT 749 ERROR_BAD_PHONE_NUMBER 750 ERROR_WRONG_MODULE	Winsock Command Reference Winsock error codes