2 /* Data pending flag */
3 external flag IOPending;
6 private SocketInputStream sin;
9 sin=new SocketInputStream(this);
10 sout=new SocketOutputStream(this);
13 public InputStream getInputStream() {
17 public OutputSream getOutputStream() {
21 public Socket(String host, int port) {
22 InetAddress address=InetAddress.getByName(host);
23 fd=nativeBind(address.getAddress(), port);
24 nativeConnect(fd, address.getAddress(), port);
27 public Socket(InetAddress address, int port) {
28 fd=nativeBind(address.getAddress(), port);
29 nativeConnect(fd, address.getAddress(), port);
32 public static native int nativeBind(byte[] address, int port);
34 public native int nativeConnect(int fd, byte[] address, int port);
36 int setFD(int filed) {
40 public int read(byte[] b) {
43 public void write(byte[] b) {
44 nativeWrite(b, 0, b.length);
47 public void write(byte[] b, int offset, int leng) {
48 nativeWrite(b, offset, len);
51 private native int nativeRead(byte[] b);
52 private native void nativeWrite(byte[] b, int offset, int len);
53 private native void nativeClose();