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(String host, int port) {
34 InetAddress address=InetAddress.getByName(host);
35 fd=nativeBind(address.getAddress(), port);
36 nativeConnect(fd, address.getAddress(), port);
39 public void connect(InetAddress address, int port) {
40 fd=nativeBind(address.getAddress(), port);
41 nativeConnect(fd, address.getAddress(), port);
44 public static native int nativeBind(byte[] address, int port);
46 public native int nativeConnect(int fd, byte[] address, int port);
48 int setFD(int filed) {
52 public int read(byte[] b) {
55 public void write(byte[] b) {
56 nativeWrite(b, 0, b.length);
59 public void write(byte[] b, int offset, int len) {
60 nativeWrite(b, offset, len);
63 private native void nativeBindFD(int fd);
64 private native int nativeRead(byte[] b);
65 private native void nativeWrite(byte[] b, int offset, int len);
66 private native void nativeClose();