5 SocketOutputStream sout;
8 sin=new SocketInputStream(this);
9 sout=new SocketOutputStream(this);
12 public InputStream getInputStream() {
16 public OutputStream getOutputStream() {
20 public Socket(String host, int port) {
21 InetAddress address=InetAddress.getByName(host);
22 fd=nativeBind(address.getAddress(), port);
23 nativeConnect(fd, address.getAddress(), port);
26 public Socket(InetAddress address, int port) {
27 fd=nativeBind(address.getAddress(), port);
28 nativeConnect(fd, address.getAddress(), port);
31 public static native int nativeBind(byte[] address, int port);
33 public static native int nativeConnect(int fd, byte[] address, int port);
35 int setFD(int filed) {
39 public int read(byte[] b) {
42 public void write(byte[] b) {
46 private native int nativeRead(byte[] b);
47 private native void nativeWrite(byte[] b);
48 private native void nativeClose();