• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How to create ssh connection with chilkatsoft library?

Status
Not open for further replies.

tiho_bg

Lurker
Dec 21, 2021
3
0
Hello,
I would like to use chilkatsoft and android studio for creation ssh connection.
I've implemented the library successfully but I have an error during ssh connect.
Here is my code:

package com.example.mobile4;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import com.chilkatsoft.*;
public class MainActivity extends AppCompatActivity {
@override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tv = new TextView(this);
CkCrypt2 crypt = new CkCrypt2();
// Display the version of the CkCrypt2 class
tv.setText(crypt.version());
setContentView(tv);
CkGlobal glob = new CkGlobal();
boolean success = glob.UnlockBundle("Anything for 30-day trial");
if (success != true) {
System.out.println(glob.lastErrorText());
System.out.println("Error 1");
return;
}
int status = glob.get_UnlockStatus();
if (status == 2) {
System.out.println("Unlocked using purchased unlock code.");
}
else {
System.out.println("Unlocked in trial mode.");
}
// The LastErrorText can be examined in the success case to see if it was unlocked in
// trial more, or with a purchased unlock code.
System.out.println(glob.lastErrorText());
CkSsh ssh = new CkSsh();
// Connect to an SSH server:
String hostname;
int port;
// Hostname may be an IP address or hostname:
hostname = "100.50.10.150";
port = 22;
success = ssh.Connect(hostname,port);
if (success != true) {
System.out.println(ssh.lastErrorText());
System.out.println("Error 2");
return;
}
}
static {
System.loadLibrary("chilkat");
}
}

The errors are:
12/21 13:36:09: Launching 'app' on HUAWEI YAL-L21.

Install successfully finished in 2 s 673 ms.

$ adb shell am start -n "com.example.mobile4/com.example.mobile4.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

Connected to process 22884 on device 'huawei-yal_l21-BQL0219C04002062'.

Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.

D/HwFrameworkSecurityPartsFactory: HwFrameworkSecurityPartsFactory in.

I/HwFrameworkSecurityPartsFactory: add HwFrameworkSecurityPartsFactory to memory.

E/BehaviorCollectManager: Fail to acquire dataAnalyzerService...

I/HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=com.example.mobile4#10209#256

need clear apicache,because volumes changed,oldCnt=0 newCnt=1

I/HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=com.example.mobile4#10209#0

need clear apicache,because volumes changed,oldCnt=1 newCnt=1

I/HwPartIawareFactory: add android.common.HwPartIawareFactoryImpl to memory.

I/AwareBitmapCacher: init processName:com.example.mobile4 pid=22884 uid=10209

E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile@744d6ca

I/ActivityThread: finishPreloaded preloadStatus 0

V/ActivityThread: callActivityOnCreate

I/DecorView[]: old windowMode:0 new windoMode:1

I/OverScrollerOptimization: start init SmartSlideOverScroller and get the overscroller config

get the overscroller config

W/example.mobile: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)

W/example.mobile: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)

I/System.out: Unlocked in trial mode.

ChilkatLog:

UnlockBundle:

DllDate: Aug 28 2021

ChilkatVersion: 9.5.0.88

UnlockPrefix: NONE

Architecture: Little Endian; 64-bit

Language: Android Java

VerboseLogging: 0

component: Global

unlockCode: Anything for 30-day trial

regKeyUnlock:

product: ChilkatBundle

hcCurDate: Tue, 21 Dec 2021 13:36:13 +0200

hcExpire: 11/2021

Component successfully unlocked using trial key

--regKeyUnlock

Success.

--UnlockBundle

--ChilkatLog

I/System.out: ChilkatLog:

Connect_Ssh:

DllDate: Aug 28 2021

ChilkatVersion: 9.5.0.88

UnlockPrefix: Anything for 30-day trial

Architecture: Little Endian; 64-bit

Language: Android Java

VerboseLogging: 0

Component successfully unlocked using trial key

connectInner:

hostname: 100.50.10.150

port: 22

sshConnect:

connectSocket:

connect_ipv6_or_ipv4:

ai_family: 2

ai_socktype: 1

ai_protocol: 6

socketErrno: 13

socketError: Permission denied

Failed to create socket for connecting.

--connect_ipv6_or_ipv4

connect_ipv6_or_ipv4:

ai_family: 2

ai_socktype: 1

ai_protocol: 6

socketErrno: 13

socketError: Permission denied

Failed to create socket for connecting.

--connect_ipv6_or_ipv4

connect_ipv6_or_ipv4:

getAddressInfo:

Failed to get host address info. (4)

gai_error: 3

hostOrIpAddr: 100.50.10.150

port: 22

Retrying DNS lookup...

Failed to get host address info. (4)

gai_error: 3

hostOrIpAddr: 100.50.10.150

port: 22

--getAddressInfo

getAddressInfo failed.

--connect_ipv6_or_ipv4

connect_ipv6_or_ipv4:

getAddressInfo:

Failed to get host address info. (4)

gai_error: 3

hostOrIpAddr: 100.50.10.150

port: 22

Retrying DNS lookup...

Failed to get host address info. (4)

gai_error: 3

hostOrIpAddr: 100.50.10.150

port: 22

--getAddressInfo

getAddressInfo failed.

--connect_ipv6_or_ipv4

--connectSocket

Failed to establish initial TCP/IP connection

hostname: 100.50.10.150

port: 22

--sshConnect

--connectInner

Failed.

--Connect_Ssh

--ChilkatLog

Error 2

D/ActivityThread: add activity client record, r= ActivityRecord{24a8ece token=android.os.BinderProxy@90e5cb1 {com.example.mobile4/com.example.mobile4.MainActivity}} token= android.os.BinderProxy@90e5cb1

I/HwPartMagicWindowFactory: add android.common.HwPartMagicWindowFactoryImpl to memory.

I/HwPartPowerOfficeFactory: add HwPartPowerOfficeFactoryImpl to memory.

D/InputEventReceiver: dispatchInputInterval 1000000

I/RmeSchedManager: init Rme, version is: v1.0

D/HiTouch_PressGestureDetector: onAttached, package=com.example.mobile4, windowType=1, mHiTouchRestricted=false

I/FrameFlow: FrameFlowInit app is not supported by frameflow solution

I/iGraphics: [0020080c] pn: com.example.mobile4, p: 22884

[0030080c] no spt app: com.example.mobile4

D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000

W/Gralloc3: mapper 3.x is not supported

I/HwViewRootImpl: removeInvalidNode jank list is null

D/DecorView: showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true

W/InputMethodManager: startInputReason = 1

W/InputMethodManager: startInputReason = 5

I/AwareBitmapCacher: init lrucache size: 2097152 pid=22884

W/InputMethodManager: startInputReason = 8

W/IInputConnectionWrapper: getExtractedText on inactive InputConnection

W/IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection

E/RtgSchedManager: endActivityTransaction: margin state not match

E/RtgSchedManager: endActivityTransaction: margin state not match

E/RtgSchedManager: endActivityTransaction: margin state not match

W/libEGL: EGLNativeWindowType 0x6f9864b450 disconnect failed

I/ActivityThread: Handle window ActivityRecord{24a8ece token=android.os.BinderProxy@90e5cb1 {com.example.mobile4/com.example.mobile4.MainActivity}} visibility: false

E/RtgSchedManager: endActivityTransaction: margin state not match

D/DecorView: showOrHideHighlightView: hasFocus=false; winMode=1; isMrgNull=true

D/RtgSched: resetRtgSchedHandle failed enable:0

D/ZrHung.AppEyeUiProbe: not watching, wait.

I/AwareBitmapCacher: handleReleaseCache: pid=22884

I/AwareBitmapCacher: init lrucache size: 2097152 pid=22884
 
Status
Not open for further replies.

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones