|
ITK Programmer's Guide |
||||||||||||
Table of contents |
Intro | General
| TCP Low Level |
TCP High Level |
UDP | DNS
| PPP
|
ITK_TCPSendFile |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||
Syntax: |
result := ITK_TCPSendFile (streamRef;pathname;filterFlag;sendBlockSize;startOffset;endOffset;options)
|
|||||||||||||||||||||||||||||||||||||||||||||
Description: |
Sends a file through a TCP stream. Under MacOS, only the
data fork of the file is sent, an option parameter
introduced with version 2.0.3 of Internet ToolKit allows to
send the resource fork under MacOS. The last two parameters allow to send only a portion of the file. ITK's internal buffer is flushed before sending the file. |
|||||||||||||||||||||||||||||||||||||||||||||
Note: |
ITK_SetTimeout can be used to set a "maximum send timeout" to be used by ITK when sending data. It the event that the remote host doesn't close the stream gracefully (disconnection, crash, etc) this "maximum send timeout" will avoid ITK to keep trying sending data. |
|||||||||||||||||||||||||||||||||||||||||||||
Params: |
|
|||||||||||||||||||||||||||||||||||||||||||||
Example: |
$stream := ITK_TCPOpen("host.domain.com";80) If ($stream#0) ... ` wait for connection to be established $err := ITK_TCPSendFile($stream;"C:\MYFILE.TXT") ... |
ITK_TCPRecvFile |
|||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
Syntax: |
result := ITK_TCPRecvFile (streamRef;pathname;filterFlag;optFlag;timeout;maxLen)
|
||||||||||||||||||||||||||||||||||||||||
Description: |
Stores all data received on a TCP stream into a file.
Filtering can be applied on the received file. The stream is automatically released before returning control to 4D unless the option flags are set to keep the stream (see optFlag below). |
||||||||||||||||||||||||||||||||||||||||
Params: |
|
||||||||||||||||||||||||||||||||||||||||
Example: |
$stream := ITK_TCPOpen("host.domain.com";80) If ($stream#0) ... ` wait for connection to be established $err := ITK_TCPRecvFile($stream;"C:\MYFILE.TXT") ` End If |
ITK_TCPSendPict |
|||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
Syntax: |
result := ITK_TCPSendPict (streamRef;picture;startOffset;endOffset)
|
||||||||||||||||||||||||||||||
Description: |
Sends a picture content or a part of it through an
established TCP stream. In that case, the picture must already be JPEG or GIF
compressed, for example: COMPRESS PICTURE($myPict;"jpeg";500) $err := ITK_TCPSendPict ($stream;$myPict) or $err := ITK_TCPSendPict ($stream; ITK_Pict2GIF($myPict))
|
||||||||||||||||||||||||||||||
Note: |
ITK_SetTimeout can be used to set a "maximum send timeout" to be used by ITK when sending data. It the event that the remote host doesn't close the stream gracefully (disconnection, crash, etc) this "maximum send timeout" will avoid ITK to keep trying sending data. |
||||||||||||||||||||||||||||||
Params: |
|
||||||||||||||||||||||||||||||
Example: |
COMPRESS PICTURE($myPict;"jpeg";500) $err := ITK_TCPSendPict($stream;$myPict) or $err := ITK_TCPSendPict($stream;ITK_Pict2GIF($myPict)) |
ITK_TCPSendBlob |
|||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
Syntax: |
result := ITK_TCPSendBlob (streamRef;blob;flushFlag;filterFlag;startOffset;endOffset)
|
||||||||||||||||||||||||||||||||||||||||
Description: |
Sends a blob content or a part of it through an
established TCP stream.
|
||||||||||||||||||||||||||||||||||||||||
Note: |
ITK_SetTimeout can be used to set a "maximum send timeout" to be used by ITK when sending data. It the event that the remote host doesn't close the stream gracefully (disconnection, crash, etc) this "maximum send timeout" will avoid ITK to keep trying sending data. |
||||||||||||||||||||||||||||||||||||||||
Params: |
|
||||||||||||||||||||||||||||||||||||||||
Example: |
$stream := ITK_TCPOpen("www.internet-toolkit.com";80) If ($stream#0) ... ` wait for connection to be established $err := ITK_TCPSendBlob($stream;myBlob) ` send the whole blob content $err := ITK_TCPSendBlob($stream;myBlob;0;0;0;1024) ` send first 1024 bytes of the blob ... |
ITK_TCPRecvBlob |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||
Syntax: |
result := ITK_TCPRecvBlob (streamRef;dataStorage;maxLen;filterFlag;options;endString;timeout)
|
|||||||||||||||||||||||||||||||||||||||||||||
Description: |
Receives data through an established TCP stream. ITK_TCPRecvBlob will return control:
|
|||||||||||||||||||||||||||||||||||||||||||||
Warning: |
The stream will be released automatically after receiving the blob, unless option 2 is used.
|
|||||||||||||||||||||||||||||||||||||||||||||
Params: |
|
|||||||||||||||||||||||||||||||||||||||||||||
Example: |
$stream := ITK_TCPOpen("mail.internet-toolkit.com";25) if ($stream#0) ... ` wait for connection to be established $result := ITK_TCPRecvBlob($stream; $myBlob; 0; 0; 2) ` receive available data in a blob ... |