80 |
public SocketChannelImpl(SelectorProvider provider) |
public SocketChannelImpl(SelectorProvider provider) |
81 |
{ |
{ |
82 |
super(provider); |
super(provider); |
|
|
|
83 |
fd = SocketCreate(); |
fd = SocketCreate(); |
84 |
|
|
85 |
if (fd == -1) |
if (fd == -1) |
137 |
} |
} |
138 |
|
|
139 |
local_port = err; |
local_port = err; |
|
|
|
140 |
connected = true; |
connected = true; |
|
|
|
141 |
return blocking; |
return blocking; |
142 |
} |
} |
143 |
|
|
154 |
public boolean isConnectionPending() |
public boolean isConnectionPending() |
155 |
{ |
{ |
156 |
if (blocking) |
if (blocking) |
157 |
return false; |
return true; |
158 |
|
|
159 |
return false; |
return false; |
160 |
} |
} |
176 |
byte[]b = new byte[len]; |
byte[]b = new byte[len]; |
177 |
|
|
178 |
bytes = SocketRead(fd, b, 0, len); |
bytes = SocketRead(fd, b, 0, len); |
|
|
|
179 |
dst.put(b, 0, bytes); |
dst.put(b, 0, bytes); |
180 |
|
|
181 |
if (bytes == 0) |
if (bytes == 0) |
187 |
return bytes; |
return bytes; |
188 |
} |
} |
189 |
|
|
|
|
|
190 |
public long read(ByteBuffer[] dsts, int offset, int length) |
public long read(ByteBuffer[] dsts, int offset, int length) |
191 |
{ |
{ |
192 |
long bytes = 0; |
long bytes = 0; |
199 |
return bytes; |
return bytes; |
200 |
} |
} |
201 |
|
|
|
|
|
202 |
public int write(ByteBuffer src) |
public int write(ByteBuffer src) |
203 |
{ |
{ |
204 |
int bytes = 0; |
int bytes = 0; |
223 |
public long write (ByteBuffer[] srcs, int offset, int length) |
public long write (ByteBuffer[] srcs, int offset, int length) |
224 |
{ |
{ |
225 |
long bytes = 0; |
long bytes = 0; |
226 |
|
|
227 |
for (int i=offset; i<length; i++) |
for (int i=offset; i<length; i++) |
228 |
{ |
{ |
229 |
bytes += write(srcs[i]); |
bytes += write(srcs[i]); |
230 |
} |
} |
231 |
|
|
232 |
return bytes; |
return bytes; |
233 |
} |
} |
234 |
} |
} |