2 /* Data pending flag */
3 external flag IOPending;
6 private SocketInputStream sin;
7 private SocketOutputStream sout;
10 sin=new SocketInputStream(this);
11 sout=new SocketOutputStream(this);
14 public InputStream getInputStream() {
18 public OutputStream getOutputStream() {
22 public Socket(String host, int port) {
23 InetAddress address=InetAddress.getByName(host);
24 fd=nativeBind(address.getAddress(), port);
25 nativeConnect(fd, address.getAddress(), port);
28 public Socket(InetAddress address, int port) {
29 fd=nativeBind(address.getAddress(), port);
30 nativeConnect(fd, address.getAddress(), port);
33 public void connect(InetAddress address, int port) {
34 fd=nativeBind(address.getAddress(), port);
35 nativeConnect(fd, address.getAddress(), port);
38 public static native int nativeBind(byte[] address, int port);
40 public native int nativeConnect(int fd, byte[] address, int port);
42 int setFD(int filed) {
46 public int read(byte[] b) {
49 public void write(byte[] b) {
50 nativeWrite(b, 0, b.length);
53 public void write(byte[] b, int offset, int len) {
54 nativeWrite(b, offset, len);
57 private native void nativeBindFD(int fd);
58 private native int nativeRead(byte[] b);
59 private native void nativeWrite(byte[] b, int offset, int len);
60 private native void nativeClose();