I can't init the InetSocketAddress, the exception is thrown when create InetSocketAddress. I run my app in 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);
The output is below. When I run this app in android 4.1.2, the app can connet to server successfully. How can I use InitSocketAddress in android 2.3.3 and 2.3.4 ?
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'