Commit Graph

33 Commits

Author SHA1 Message Date
Matt Klich
7148556979 OSX Lion build changes 2011-05-26 11:57:30 -06: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
a5742f5985 update copyright years 2010-12-05 20:21:09 -07: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
f3a1c3253e use closesocket instead of close on Windows
MinGW's close apparently does nothing, and MSVC's headers don't even
declare it, so closesocket is the way to go.
2010-06-04 18:45:13 -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
Matt Klich
83c51f4801 Fix signed vs. unsigned comparison for 32bit build with mingw64 2010-05-13 16:59:08 -06:00
Joel Dice
fdf9c5087b register socket with exceptfds when calling select on Windows
This allows us to get connection errors like WSAECONNREFUSED in
non-blocking mode.
2010-02-19 16:41:27 -07:00
Joel Dice
30db38ebd6 replace calls to ExceptionOccurred with calls to ExceptionCheck
The latter is cheaper (avoids a state transition and possible memory
allocation) when we just want to know if an exception is thrown
without needing a handle to that exception.
2009-12-16 19:25:03 -07: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
b15ff58542 provide a useful error message when throwing IOExceptions from Java_java_nio_channels_SocketChannel_natFinishConnect 2009-10-27 09:17:08 -06:00
Joel Dice
1b893c7a19 check for EINPROGRESS in Java_java_nio_channels_SocketChannel_natFinishConnect 2009-10-12 09:28:04 -06:00
Joel Dice
59ba4aecf2 implement non-blocking socket connections 2009-10-08 16:26:20 -06:00
Mike Keesey
77fb0083a4 updated nio native code to properly check for PIPE closure on POSIX OSes 2009-10-05 09:23:53 -06:00
Joel Dice
1a0eef7e2d add support for building with MSVC on Windows 2009-08-26 18:26:44 -06:00
jet
1ffe46a545 added ARM interpreted mode supported 2009-08-06 11:52:36 -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
fccf906349 add minimal java.net.Socket implementation to support Socket.setTcpNoDelay 2008-11-22 15:32:53 -07:00
Joel Dice
f423d39b25 explicitly include stdint.h in java-nio.cpp 2008-10-10 11:49:07 -06:00
Frank Jacobs
68513521ef support building on Windows using MinGW
Here is a patch for getting Avian to build in Windows. I used MinGW
and MSYS for the build environment. The patch has the following
changes:

1. java-nio.cpp: Had to add an include and remove a function
declaration that was reported as duplicate.
2. readme.txt: Updated the instructions to include notes about
building on Windows.
3. makefile: Added a conditional for MinGW. I left the existing "ifeq
($(platform),windows)" conditional alone so as to not break
cross-compiled Windows builds. There are some similarities between the
two, so it might be possible to combine portions of them in an elegant
manner. Since I'm not sure how the cross-compiled builds have been
done, I didn't want to mess with that portion of the makefile.
2008-10-10 08:06:31 -06:00
Joel Dice
b59422fa94 fix windows build, where hstrerror is not available 2008-07-21 15:29:02 -06:00
Joel Dice
5b94b17ea2 clean up exception handling in java-nio.cpp 2008-07-21 15:35:14 -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
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
4b92017ea9 fix several win32 bugs in SocketSelector 2007-10-26 18:04:55 -06:00
Joel Dice
eaf1d205cd more windows port fixes 2007-10-24 11:24:19 -06:00
Joel Dice
e145d09523 fix posix build breakage 2007-10-23 17:22:42 -06:00
Joel Dice
1381267e70 mork work on the windows port 2007-10-23 11:22:48 -06:00
Eric Scharff
782081d1ff Use custom initialization scheme to allow the java-nio library to be linked without
the stdc++ library, using a custom operator new
2007-10-08 13:05:56 -06:00
Eric Scharff
19b6e11cbc Make sure to report EOF when reading from a socket channel 2007-10-05 15:51:06 -06:00
Eric Scharff
98269286e5 Implemented a basic NIO socket channel interface. Non-blocking socket channels
and server socket channels are implemented.  This version works but only when
libnative is linked with g++ (because of C++ object creation code that fails
without this linking)
2007-10-05 15:32:56 -06:00