/* File Descriptor */
int fd;
private SocketInputStream sin;
+ private SocketOutputStream sout;
public Socket() {
sin=new SocketInputStream(this);
return sin;
}
- public OutputSream getOutputStream() {
+ public OutputStream getOutputStream() {
return sout;
}
nativeConnect(fd, address.getAddress(), port);
}
+ public void connect(InetAddress address, int port) {
+ fd=nativeBind(address.getAddress(), port);
+ nativeConnect(fd, address.getAddress(), port);
+ }
+
public static native int nativeBind(byte[] address, int port);
public native int nativeConnect(int fd, byte[] address, int port);
nativeWrite(b, 0, b.length);
}
- public void write(byte[] b, int offset, int leng) {
+ public void write(byte[] b, int offset, int len) {
nativeWrite(b, offset, len);
}
this.offset=0;
}
+ public String(byte str[], int offset, int length) {
+ if (length>(str.length-offset))
+ length=str.length-offset;
+ char charstr[]=new char[length];
+ for(int i=0;i<length;i++)
+ charstr[i]=(char)str[i+offset];
+ this.value=charstr;
+ this.count=str.length;
+ this.offset=0;
+ }
+
public String(String str) {
this.value=str.value;
this.count=str.count;