dear all ,
I'm trying to write a socket program . using the SocketChannel.. .
but I don't receive any thing from the server. why ???????
this my code
I'm trying to write a socket program . using the SocketChannel.. .
but I don't receive any thing from the server. why ???????
this my code
Code:
address = new InetSocketAddress("***.***.**.**",**** );
channel = SocketChannel.open(address);
byte[] b = getAuthenticationLoginString("***","********");
ByteBuffer bbuf = ByteBuffer.allocate(b.length);
bbuf.put(b);
channel.write(bbuf);
channel.configureBlocking(false);
Thread.sleep(2000);
ByteBuffer responsebuf = ByteBuffer.allocateDirect(1024);
int n = channel.read(responsebuf);
System.out.println(n);
if(n < 0 )
channel.close();
else
{
byte[] v = new byte[1024];
responsebuf.get(v);
String returnString = decryptReturnedResponse(v);
}
Comment