import java.io.*;
import java.nio.*;
import java.nio.channels.*;
import java.nio.charset.*;
import java.net.*;

class GetDayTime {
  public static void main(String args[]) throws Exception {
    if (args.length != 2)
      System.out.println("usage : java GetDayTime hote port");
    else {
      String hote = args[0];
      int port = Integer.parseInt(args[1]);
      InetSocketAddress hoteAdress = new InetSocketAddress(hote, port);
      SocketChannel socket = SocketChannel.open(hoteAdress);
      Charset charset = Charset.forName("US-ASCII");
      CharsetDecoder decoder = charset.newDecoder();
      ByteBuffer byteBuf = ByteBuffer.allocate(10);
      while (socket.read(byteBuf) != -1) {
        byteBuf.flip();
        decoder.reset();
        CharBuffer charBuf = decoder.decode(byteBuf);
        System.out.print(charBuf.toString());
        byteBuf.clear();
      }
      System.out.println();
      socket.close();
    }
  }
}
         

