Commit Graph

66 Commits

Author SHA1 Message Date
Joel Dice
cbde34620c update copyright years 2015-03-13 12:52:59 -06:00
Joel Dice
4fd8396ba3 fix WSA error 10093 when openning a ServerSocketChannel
We need to call Socket.init before trying to use the Windows Socket
library.  We were already doing this in SocketChannel.open, but not in
ServerSocketChannel.open.
2014-11-07 11:31:19 -07:00
Joel Dice
9b7d0d1624 update copyright years 2014-04-23 15:33:41 -06:00
Joel Dice
d00debd250 fix Java 6 build
Java 6's javac is not as smart as Java 7's when it comes to calling
overloaded methods from an inner class, so we have to be more
explicit.
2014-04-07 14:05:54 -06:00
Joel Dice
6e7149061c various refinements to network implementation
The main idea is to make DatagramChannel and *SocketChannel behave in
a way that more closely matches the standard, e.g. allow binding
sockets to addresses without necessarily listening on those addresses
and accept null addresses where appropriate.  It also avoids multiple
redundant DNS lookups.

This commit also implements CharBuffer and BindException, and adds the
Readable interface.
2014-03-31 15:22:14 -06:00
Johannes Schindelin
b1d2f66194 Add FileChannel#size()
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-04 15:23:03 -06:00
Ilya Mizus
45ee25f68c Implement socket API 2013-11-08 09:55:43 -07:00
Johannes Schindelin
3a67f81b50 Add the FileChannel class
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 10:59:59 -05:00
Johannes Schindelin
caec6eba67 Add the BufferUnderflowException
Pre-compiled code might expect the class to exist...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 10:59:59 -05:00
Johannes Schindelin
4f83f8dd98 ByteBuffer: add missing order() methods
Avian's ByteBuffer implementation is actually fixed to big endian. So
let's throw an exception if the user tries to change that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 10:59:59 -05:00
Joel Dice
87b02eb949 update copyright years
Previously, I used a shell script to extract modification date ranges
from the Git history, but that was complicated and unreliable, so now
every file just gets the same year range in its copyright header.  If
someone needs to know when a specific file was modified and by whom,
they can look at the Git history themselves; no need to include it
redundantly in the header.
2013-07-02 20:52:38 -06:00
JET
b66d8b9fbf Expanded DatagramChannel and corrected blocking configuration in connect(). 2013-07-02 10:10:05 -06:00
Pierre Carrier
74b070f9cc classpath: java.nio.ByteOrder
Used by jruby.
(Not saying I'm gonna implement String.format :)
2012-11-11 06:06:18 +01:00
Joel Dice
2d9bbec214 fix a couple of ByteBuffer regressions
The compact() and put(ByteBuffer) methods regressed as of the recent
refactoring to support direct byte buffers.
2012-09-14 11:40:26 -06:00
Mike Jensen
3372210f45 Added .get() implementation 2012-08-16 16:13:51 -06:00
Joel Dice
01be4b23bb implement JNI methods needed by AWT
These include PushLocalFrame, PopLocalFrame, NewDirectByteBuffer,
GetDirectBufferAddress, and GetDirectBufferCapacity.
2012-08-11 06:56:19 -06:00
Joel Dice
9974d91648 implement DatagramChannel.receive and fix Datagrams to be Java 6 compatible 2012-07-10 14:09:14 -06:00
Joel Dice
c602f4673b implement java.nio.channels.DatagramChannel 2012-07-03 11:24:05 -06:00
Joel Dice
0addd8c814 update copyright years 2012-05-11 17:43:27 -06:00
Joel Dice
b45528203d avoid crashes due to calling select or wakeup on a closed Selector 2012-01-31 09:48:05 -07:00
Joel Dice
807f2a8d51 avoid crash when Selector.close is called more than once on the same instance 2012-01-30 13:42:32 -07:00
Joel Dice
6153a5c83b Merge remote-tracking branch 'git/master' 2011-11-04 08:11:14 -06:00
JET
39bee886e3 ByteBuffer and InputStream now better match the standard. 2011-10-20 13:45:47 -06:00
Joel Dice
84bcbbcaa3 implement asReadOnlyBuffer and getShort(int) in ByteBuffer 2011-09-29 18:25:03 -06:00
Joel Dice
0c253c40a2 add ServerSocketChannel.handleReadyOps to fix build 2011-01-13 07:03:28 -07:00
Joel Dice
39018c20e0 check connection readyness in SocketChannel.finishConnect if necessary 2011-01-11 18:39:48 -07:00
Joel Dice
eb3a9f010b fix false positive return from SocketChannel.finishConnect
This fixes a bug in finishConnect such that it would return true even
if the socket had not yet connected successfully.
2011-01-11 18:29:48 -07:00
Joel Dice
4f0dccb53c add Channels.newChannel methods 2011-01-11 18:26:37 -07:00
Joel Dice
a5742f5985 update copyright years 2010-12-05 20:21:09 -07:00
Joel Dice
b3accf1b30 ServerSocketChannel throws IOException, not Exception 2010-10-13 13:38:31 -06:00
Joel Dice
b3da635b63 add java.nio.channels.Channels implementation 2010-07-13 18:03:25 -06:00
Joel Dice
47d9039b69 switch from gethostbyname to getaddrinfo on POSIX systems
gethostbyname may return any combination of IPv4 and IPv6 addresses,
and it's not safe to assume the first address is IPv4, which is all
our code is currently prepared to handle.  In contrast, getaddrinfo
allows us to specify whether we want IPv4, IPv6, or both.

We should eventually make this switch on Windows as well, but the
status of getaddrinfo in Windows 2000 is not clear, and MinGW's
ws2tcpip.h only declares it for XP and above.

This commit also adds InetAddress.getByName for explicit DNS lookups.
2010-06-14 16:09:56 -06:00
Joel Dice
b908f575d5 fix several blocking SocketChannel bugs
In java-nio.cpp, we can't use GetPrimitiveArrayCritical when reading
from or writing to blocking sockets since it may block the rest of the
VM indefinitely.

In SelectableChannel.java, we can't use a null test on
SelectableChannel.key to determine whether the channel is open since
it might never be registered with a Selector.  According to the Sun
documentation, a SelectableChannel is open as soon as it's created, so
that's what we now implement.
2010-06-04 15:37:22 -06:00
Joel Dice
6118792ffd update copyright years 2009-12-02 19:08:29 -07:00
Joel Dice
3862128a3a tolerate EINTR in ServerSocketChannel.accept implementation
On POSIX systems, Avian sends a special signal to a thread to
implement Thread.getStackTrace() when called from a different thread.
If the target thread is blocked on a call to accept when this happens,
it will return -1, with errno set to EINTR.  Instead of treating this
as an error, we now just loop and call accept again.
2009-11-16 17:23:09 -07:00
Joel Dice
ef00ff80ef avoid EAGAIN or EWOULDBLOCK errors due to SocketSelector.wakup being called many times between calls to select 2009-10-30 08:55:55 -06:00
Joel Dice
efdfb796d9 implement SocketChannel.isConnected 2009-10-29 16:19:33 -06:00
Joel Dice
59ba4aecf2 implement non-blocking socket connections 2009-10-08 16:26:20 -06:00
Joel Dice
fb40b046fd fix regression in SocketSelector when selecting ServerSocketChannels 2009-09-28 16:54:49 -06:00
Joel Dice
80d4385cb8 implement blocking mode for SocketChannel and ServerSocketChannel 2009-08-03 08:58:56 -06:00
Joel Dice
29858a5299 implement Selector.selectNow() and select() 2009-07-23 13:08:41 -06:00
Joel Dice
d1018bf078 update copyright years 2009-03-15 12:02:36 -06:00
Joel Dice
8659c709b7 avoid passing null arguments to native methods in SocketChannel 2009-03-02 15:22:17 -07:00
Joel Dice
fccf906349 add minimal java.net.Socket implementation to support Socket.setTcpNoDelay 2008-11-22 15:32:53 -07:00
Joel Dice
86dfaf9ff0 implement ByteBuffer.getInt(int) 2008-08-12 11:09:17 -06:00
Joel Dice
91494d9081 add constructor to ByteBuffer 2008-03-28 18:08:08 -06:00
Joel Dice
6cddd10e0a various code cleanups, bug fixes, and compatibility fixes in NIO code 2008-03-25 16:17:29 -06:00
Joel Dice
3a208edbbc update NIO code to be more compatible with Java 2008-03-25 11:18:17 -06:00
Joel Dice
2edaa82801 prepend copyright notice and license to all source files; add license.txt and readme.txt 2008-02-19 11:06:52 -07:00
Joel Dice
a6a1f8ba98 make ByteBuffer implement Comparable 2007-11-15 11:53:01 -07:00