FoxPro Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Visual FoxPro Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
Email Object
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
Socket
Spider
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
String
Tar
Upload
XML
XMP
Zip Compression
Self-Extractor

More Examples...
Amazon S3
DKIM / DomainKey
NTLM
RSS
Atom
Byte Array
Service
PPMD
Deflate
DH Key Exchange
DSA
FileAccess
Bzip2
LZW

 

Non-Chilkat Links
Text and String Handling

Receive File on Socket

Demonstrates how to listen for an incoming socket connection and receive a file. The received file is saved to disk.

Download Chilkat FileAccess ActiveX (freeware)

Download Chilkat Socket ActiveX

LOCAL loListenSocket
LOCAL lnSuccess
LOCAL loConnectedSocket
LOCAL lnFileSize
LOCAL loFileData
LOCAL loFac

loListenSocket = CreateObject('Chilkat.Socket')

lnSuccess = loListenSocket.UnlockComponent("Anything for 30-day trial")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX("Failed to unlock component")
    QUIT
ENDIF

*  Bind to a port and listen for incoming connections:
*  This example will listen at port 5555 and allows for a backlog
*  of 25 pending connection requests.
lnSuccess = loListenSocket.BindAndListen(5555,25)
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loListenSocket.LastErrorText)
    QUIT
ENDIF

*  Get the next incoming connection
*  Wait a maximum of 20 seconds (20000 millisec)

loConnectedSocket = loListenSocket.AcceptNextConnection(20000)
IF (loConnectedSocket = NULL ) THEN
    =MESSAGEBOX(loListenSocket.LastErrorText)
    QUIT
ENDIF

*  Set maximum timeouts for reading an writing (in millisec)
loConnectedSocket.MaxReadIdleMs = 10000
loConnectedSocket.MaxSendIdleMs = 10000

*  Receive the byte count of the file data that is forthcoming:

lnFileSize = loConnectedSocket.ReceiveCount()
IF (lnFileSize < 0) THEN
    =MESSAGEBOX(loConnectedSocket.LastErrorText)
    QUIT
ENDIF

loFileData = loConnectedSocket.ReceiveBytesN(lnFileSize)
IF (loConnectedSocket.LastMethodFailed = 1) THEN
    =MESSAGEBOX(loConnectedSocket.LastErrorText)
    QUIT
ENDIF

*  Close the connection.
*  Wait a max of 20 seconds (20000 millsec)
loConnectedSocket.Close(20000)

*  Write the received data to a file.
*  This example receives a GIF image file.
loFac = CreateObject('Chilkat.FileAccess')

lnSuccess = loFac.WriteEntireFile("received.gif",loFileData)
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loListenSocket.LastErrorText)
    QUIT
ENDIF

=MESSAGEBOX("success!")

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.

Mail Component · .NET Email Component · ASP Mail Component · XML Parser