2002-09-21 Michael Koch <konqueror@gmx.de>
* java/net/Socket.java (sendUrgentData): New method. (getChannel): New method. * java/net/ServerSocket.java (getChannel): New method. (isBound): New method. * java/net/DatagramSocket.java (DatagramSocket): Two new methods. (bind): New method. (getChannel): New method. (isBound): New method. (send): Added newline to to make shorter lines. * java/net/PlainDatagramSocketImpl.java (mcastGrp): Added argument. (join): Use new mcastGrp. (leave): Use new mcastGrp. (joinGroup): New method. (leaveGroup): New method. * java/net/natPlainDatagramSocketImpl.cc (mcastGrp): Added argument, no yet really implemented. (getOption): Added newline for shorter lines. * java/net/natPlainSocketImpl.cc (read, setOption, getOption): Added newline for shorter lines. From-SVN: r57380
This commit is contained in:
parent
84d7dd4a53
commit
be362a0d5b
7 changed files with 205 additions and 13 deletions
|
@ -38,6 +38,7 @@ exception statement from your version. */
|
|||
package java.net;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
|
||||
/* Written using on-line Java Platform 1.2 API Specification.
|
||||
* Status: I believe all methods are implemented.
|
||||
|
@ -74,6 +75,12 @@ public class ServerSocket
|
|||
*/
|
||||
private SocketImpl impl;
|
||||
|
||||
/**
|
||||
* ServerSocketChannel of this ServerSocket. This channel only exists
|
||||
* when the socket is created by ServerSocketChannel.open().
|
||||
*/
|
||||
private ServerSocketChannel ch;
|
||||
|
||||
/**
|
||||
* Private constructor that simply sets the implementation.
|
||||
*/
|
||||
|
@ -281,6 +288,39 @@ public class ServerSocket
|
|||
impl.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unique ServerSocketChannel object
|
||||
* associated with this socket, if any.
|
||||
*
|
||||
* The socket only has a ServerSocketChannel if its created
|
||||
* by ServerSocketChannel.open.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public ServerSocketChannel getChannel()
|
||||
{
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true then the socket is bound, otherwise false
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public boolean isBound()
|
||||
{
|
||||
try
|
||||
{
|
||||
Object bindaddr = impl.getOption (SocketOptions.SO_BINDADDR);
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of SO_TIMEOUT. A value of 0 implies that SO_TIMEOUT is
|
||||
* disabled (ie, operations never time out). This is the number of
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue