/* Socket.java -- Client socket implementation
- Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2006
+ Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2006, 2007
Free Software Foundation, Inc.
This file is part of GNU Classpath.
SocketImpl impl;
/**
+ * True if impl.create() has been called.
+ */
+ // package-private because ServerSocket.implAccept() needs to access it.
+ boolean implCreated;
+
+ /**
* True if the socket is bound.
* Package private so it can be set from ServerSocket when accept is called.
*/
private SocketImpl getImpl() throws SocketException
{
+ if (! implCreated)
+ {
+ try
+ {
+ impl.create(true);
+ }
+ catch (IOException x)
+ {
+ throw (SocketException) new SocketException().initCause(x);
+ }
+ implCreated = true;
+ }
return impl;
}
/**
- * Binds the socket to the givent local address/port
+ * Binds the socket to the given local address/port
*
* @param bindpoint The address/port to bind to
*
// bind to address/port
try
{
- getImpl().create(true);
getImpl().bind(tmp.getAddress(), tmp.getPort());
bound = true;
}