InetSocketAddress を初期化できません。InetSocketAddress の作成時に例外がスローされます。Android 2.3.4 でアプリを実行しています。
Log.i("Test", "Hien Connect host="+_host+" & port="+_port);
try
{
_socket_channel = SocketChannel.open();
_socket_channel.configureBlocking(false);
Log.i("Test", "Hien Connect 34");
//InetSocketAddress socketAddress = new InetSocketAddress(InetAddress.getByAddress(b), _port);
_socket_channel.connect(new InetSocketAddress(_host, _port));
//_socket_channel.connect(socketAddress);
出力は以下のとおりです。このアプリを Android 4.1.2 で実行すると、アプリはサーバーに正常に接続できます。Android 2.3.3 および 2.3.4 で InitSocketAddress を使用するにはどうすればよいですか?
06-07 16:32:16.695: I/Pixma(16303): Hien Connect 34
06-07 16:32:16.780: E/dalvikvm(16303): Class lookup Ljava/lang/NullPointerException; attempted while exception Ljava/net/UnknownHostException; pending
06-07 16:32:16.780: I/dalvikvm(16303): DALVIK THREADS:
06-07 16:32:16.780: I/dalvikvm(16303): (mutexes: tll=0 tsl=0 tscl=0 ghl=0 hwl=0 hwll=0)
06-07 16:32:16.780: I/dalvikvm(16303): "main" prio=5 tid=1 RUNNABLE
06-07 16:32:16.780: I/dalvikvm(16303): | group="main" sCount=0 dsCount=0 obj=0x400281b8 self=0xcec0
06-07 16:32:16.780: I/dalvikvm(16303): | sysTid=16303 nice=0 sched=0/0 cgrp=default handle=-1345006496
06-07 16:32:16.780: I/dalvikvm(16303): | schedstat=( 169151824 239494686 1029 )
06-07 16:32:16.780: I/dalvikvm(16303): at java.net.InetAddress.getHostName(InetAddress.java:~355)
06-07 16:32:16.780: I/dalvikvm(16303): at java.net.InetSocketAddress.<init>(InetSocketAddress.java:69)
06-07 16:32:16.780: I/DEBUG(13679): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-07 16:32:16.780: I/DEBUG(13679): Build fingerprint: 'samsung/GT-I9100/GT-I9100:2.3.3/GINGERBREAD/DXKG3:user/release-keys'