Press on the image to return to the main documentation page.
jNet
The Net library implements the following protocols: FTP, SMTP and POP3. Both regular connections and secured connections are supported. The implementations are based on Apache Commons Net. All the methods in this library are non-blocking. This library replaces the FTP library.
DownloadCompleted (ServerPath As String, Success As Boolean) DownloadProgress (ServerPath As String, TotalDownloaded As Long, Total As Long) UploadCompleted (ServerPath As String, Success As Boolean) UploadProgress (ServerPath As String, TotalUploaded As Long, Total As Long) DeleteCompleted (ServerPath As String, Success As Boolean) CommandCompleted (Command As String, Success As Boolean, ReplyCode As Int, ReplyString As String) ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
Similar to UploadFile. Appends the data to an existing file (if such exists).
Close
Closes the connection after all submitted tasks finish. Note that this method does not block.
CloseNow
Closes the connection immediately without waiting for current tasks to finish. The data connection will only be closed when UploadProgress or DownloadProgress events fire.
DeleteFile (ServerPathAsString) AsObject
Deletes a file from the server. The DeleteCompleted event will be raised when this task completes. Returns an object that can be used as the sender filter parameter in a Wait For call.
Downloads a file from the server. The DownloadCompleted event will be raised when download completes. Returns an object that can be used as the sender filter parameter in a Wait For call. DownloadProgress events will be raised during download. ServerFilePath - Full path to the remote file. AsciiFile - If True then end of line characters will be converted as needed. Note that Android end of line character is the same as Unix / Linux. DeviceFolder - Folder that the file will be saved to. DeviceFile - The name of the local file that will be created.
Initializes the object and sets the subs that will handle the events
IsInitializedAsBoolean
Tests whether the object was initialized.
List (ServerPathAsString) AsObject
Fetches the list of folders and files in the specified path. The ListCompleted event will be raised when the data is available. Returns an object that can be used as the sender filter parameter in a Wait For call.
PassiveModeAsBoolean
Gets or sets whether FTP is in passive mode. The default mode is active mode.
Sends an FTP command. The CommandCompleted event will be raised with the server reply. Should only be used with commands that return the reply in the command channel (not the data channel). It is possible that Success will be false and LastException will not be initialized. Returns an object that can be used as the sender filter parameter in a Wait For call.
Common commands: MKD - Creates a new folder. RMD - Deletes an empty folder. Example: FTP.SendCommand("MKD", "/somefolder/newfolder")
SetCustomSSLTrustManager (TrustManagerAsObject)
TimeoutMsAsInt
Communication timeout in milliseconds. The default value is 60000 (60 seconds).
Uploads a file to the server. The UploadCompleted event will be raised when upload completes. Returns an object that can be used as the sender filter parameter in a Wait For call. UploadProgress events will be raised during the upload. DeviceFolder - Local folder. DeviceFile - Local file name. AsciiFile - If True then end of line characters will be converted as needed. Note that Android end of line character is the same as Unix / Linux. ServerFilePath - Full path to file that will be created on the server.
UseSSLAsBoolean
Gets or sets whether the connection should be done with SSL sockets (FTPS Implicit).
UseSSLExplicitAsBoolean
Gets or sets whether the connection should be done with SSL sockets (FTPS Explicit).
POP3 object allows you to connect to mail servers and read the mail messages. This object returns the raw string of each message, including the headers. Parsing the raw string is currently out of the scope of this library. The connection is established when it is first required. ListCompleted event passes a parameter named Messages. This is a map with the messages IDs as keys and the messages sizes as values. DownloadCompleted event passes the message raw string in the Message parameter. Example: SubProcess_Globals DimPOPAsPOP3 EndSub SubGlobals
SubPOP_ListCompleted (SuccessAsBoolean, MessagesAsMap)
Log("List: " & Success)
IfSuccessThen Fori = 0ToMessages.Size - 1 Pop.DownloadMessage(Messages.GetKeyAt(i), True) 'Download all messages and delete them Next Else Log(LastException.Message)
EndIf POP.Close'The connection will be closed after all messages are downloaded EndSub SubPOP_DownloadCompleted (SuccessAsBoolean, MessageIdAsInt, MessageAsString)
Log("Download: " & Success & ", " & MessageId)
IfSuccessThen Log(Message)
Log(Message.Length)
Log(MessageId)
Else Log(LastException.Message)
EndIf EndSub
Events:
ListCompleted (Success As Boolean, Messages As Map) DownloadCompleted (Success As Boolean, MessageId As Int, Message As String) StatusCompleted (Success As Boolean, NumberOfMessages As Int, TotalSize As Int)
Calls the server and downloads a message. When the message is ready the DownloadedCompleted event is raised. Returns an object that can be used as the sender filter parameter in a Wait For call. MessageId - The message id which was previously retrieved by calling ListMessages. Delete - Whether to delete the message after it is downloaded. Note that the message will only be deleted after the connection is closed.
Calls the server and downloads the top number of lines from the message. When the message is ready the DownloadedCompleted event is raised. Returns an object that can be used as the sender filter parameter in a Wait For call. MessageId - The message id which was previously retrieved by calling ListMessages. NumberOfLines - Maximum number of lines to read from the message. Delete - Whether to delete the message after it is downloaded. Note that the message will only be deleted after the connection is closed.
Initializes the object. Server - Server address. Host name or Ip. Port - Mail server port. Username - Account user name. Password - Account password. EventName - The name of the sub that will handle the MessageSent event.
IsInitializedAsBoolean
ListMessagesAsObject
Calls the server and when data is ready raises the ListCompleted event. Returns an object that can be used as the sender filter parameter in a Wait For call. See the example described above.
SetCustomSSLTrustManager (TrustManagerAsObject)
StatusAsObject
Gets the mailbox status. The StatusCompleted event will be raised when the request is completed with the number of messages and the total size. Returns an object that can be used as the sender filter parameter in a Wait For call.
UseSSLAsBoolean
Gets or sets whether the connection should be done with SSL sockets.
SMTP object allows you to send emails with no user intervention and without relying on the device installed mail clients. Both text messages and Html messages are supported as well as file attachments. There are two encryption modes supported: UseSSL and StartTLSMode. UseSSL means that the connection will be based on a SSL connection right from the start. StartTLSMode means that the connection will only be upgraded to SSL after the client send the STARTTLS command. Most SMTP servers support this mode. Gmail for example supports both modes. UseSSL on port 465 and StartTLSMode on port 587.
Initializes the object. Server - Server address. Host name or Ip. Port - Mail server port. Username - Account user name. Password - Account password. EventName - The name of the sub that will handle the MessageSent event.
MailFromAsString
Gets or sets the mail address that is sent with the MAIL command. By default it is the same as the Username.
SendAsObject
Sends the message. The MessageSent event will be raised after the message was sent. Returns an object that can be used as the sender filter parameter in a Wait For call. Note that the message fields are cleared after this method to allow you to send new messages with the same object.
SenderAsString
Gets or sets the Sender header. By default it is the same as the Username.
SetCustomSSLTrustManager (TrustManagerAsObject)
StartTLSModeAsBoolean
Gets or sets whether the connection should be done in StartTLS mode.
SubjectAsString
Gets or sets the message subject.
ToAsList
Gets or sets the list of "To" recipients. Example:SMTP.To.Add("email@example.com")
UseSSLAsBoolean
Gets or sets whether the connection should be done with SSL sockets.
Top