trakbas.blogg.se

Purebasic Serial Port Example
Purebasic Serial Port Example






Purebasic Serial Port Example

Success = CkSsh:: ckChannelSendClose(ssh,channelNum)

Purebasic Serial Port Example

HtmlBody = CkSsh:: ckGetReceivedText(ssh,channelNum, "ansi") A return value greater than 0 indicates that additional data was received.ĭebug "- HTML BODY -" Extract the remainder of the accumulated data in the internal receive buffer. A return value of -2 means that no data was available and the poll simply timed out (not an error) A return value of -1 indicates an error. NumBytesRead = CkSsh:: ckChannelPoll(ssh,channelNum,pollTimeoutMs) Therefore, we'll poll for any remaining data and wait a max of. Now get the body of the HTTP response (this is the HTML content of It's possible we've already received the entire HTTP response in the call to ChannelReceiveUntilMatch. ResponseHeader = CkSsh:: ckGetReceivedTextS(ssh,channelNum,matchStr, "ansi") (GetReceiveTextS extracts up to and including the match string from the receive buffer) ProcedureReturn EndIf Extract the HTTP header from the receive buffer. Success = CkSsh:: ckChannelReceiveUntilMatch(ssh,channelNum,matchStr, "ansi",caseSensitive) ChannelReceiveUntilMatch may read beyond the match string, but it will stop reading as soon as the match string is seen. Calling ChannelReceiveUntilMatch will receive until match string is seen, or until a timeout occurs (IdleTimeoutMs property). First read the HTTP response header which ends with a double CRLF. ProcedureReturn EndIf Get the HTTP response. the web server in this example).ĬhannelNum = CkSsh:: ckOpenDirectTcpIpChannel(ssh, "80) It can be your own customer application server that listens on a port, or any other type of server.) When we read from the SSH channel, we'll be reading data sent from the remote host:port (i.e. (Note: The remote host:port does not need to be a web server. Data sent through the SSH tunnel is forwarded to the remote host:port. We want the SSH server to connect to port 80 (i.e. ProcedureReturn EndIf Open a direct-tcpip channel. Success = CkSsh:: ckAuthenticatePw(ssh, "chilkat", "myPassword") ProcedureReturn EndIf Wait a max of 5 seconds when reading responses. Success.i = CkSsh:: ckConnect(ssh,hostname,port) Hostname may be an IP address or hostname: See Global Unlock Sample for sample code.

Purebasic Serial Port Example

This example assumes the Chilkat API to have been previously unlocked.

#Purebasic Serial Port Example how to

(PureBasic) SSH Tunnel (Port Forwarding via direct-tcpip channel)ĭemonstrates how to create an SSH tunnel to a remote hostname:port via a direct-tcpip channel.








Purebasic Serial Port Example