public static void socketBindImpl(FileDescriptor aFD, int localPort, InetAddress localAddress) throws SocketException {  VM_BootRecord bootRecord = VM_BootRecord.the_boot_record; int rc = VM.sysCall4(bootRecord.sysNetSocketBindIP, aFD.fd, localAddress.family, localAddress.address, localPort);  if (rc != 0) throw new BindException();  }
public static void setSocketOptionImpl(FileDescriptor aFD, int option, Object optVal)	throws SocketException {       VM_BootRecord bootRecord = VM_BootRecord.the_boot_record;              switch (option)          {          case SocketOptions.SO_LINGER: {	  if (optVal instanceof Integer)	      { // when socket is closed on this end, wait until unsent data has been received		  // by other end or timeout expires		  //		  int rc = VM.sysCall3(bootRecord.sysNetSocketLingerIP, aFD.fd, 1, ((Integer)optVal).intValue());		  if (rc == -1) throw new SocketException("SO_LINGER"); // !!TODO: what additional details should be supplied with exception?	      }	  else	      { // when socket is closed on this end, discard any unsent data		  //		  int rc = VM.sysCall3(bootRecord.sysNetSocketLingerIP, aFD.fd, 0, 0);		  if (rc == -1) throw new SocketException("SO_LINGER"); // !!TODO: what additional details should be supplied with exception?	      }	  } break;          case SocketOptions.TCP_NODELAY:          { // true:  send data immediately when socket is written to            // false: delay sending, in order to coalesce packets          int rc = VM.sysCall2(bootRecord.sysNetSocketNoDelayIP,				     aFD.fd,				     ((Boolean)optVal).booleanValue() ? 1 : 0);          if (rc == -1) throw new SocketException("setTcpNoDelay");          break;          }                    default:          VM.assert(VM.NOT_REACHED);          }    }  // end method setSocketOptionImpl/** * Bind the socket to the port/localhost in the IP stack. * * Associate a local address and port with this socket. * Taken:    desired local address *           desired local port * Returned: nothing (socket is bound) * * @author		Derek * @version		initial * * @param		aFD		the socket descriptor * @param		localPort	the option selector * @param		localAddress	the nominated option value * @exception	SocketException		thrown if bind operation fails */public static void socketBindImpl(FileDescriptor aFD, int localPort,			   InetAddress localAddress)	throws SocketException {       VM_BootRecord bootRecord = VM_BootRecord.the_boot_record;       int rc = VM.sysCall4(bootRecord.sysNetSocketBindIP,				  aFD.fd,				  localAddress.family,				  localAddress.address,				  localPort);       if (rc != 0)          throw new BindException();}  // end method socketBindImpl