![]() This method just execute the same security checks as the connect method of the DatagramSocket address The address to be This ClosedChannelException If the channel is already AsynchronousCloseException If the channel is closed by another thread while this method is in ClosedByInterruptException If another thread interrupts the calling thread while the operation is in progress. The connect status won't changed before disconnected and closed. This method can be called at any moment, and won't affect the processing read and write operation. .connect()Ĭonnect the socket of this channel to a remote address, which is the only communication peer of getting and sending datagrams after connected.That is, if a security manager has beeninstalled then this method verifies that its #checkConnect checkConnect} method permitsconnecting to the address and port number of the given remote The type of the remote The remote address to which this channel is to be attachment The object to attach to the I/O operation can be handler The handler for consuming the UnresolvedAddressException If the given remote address is not fully UnsupportedAddressTypeException If the type of the given remote address is not Alread圜onnectedException If this channel is already ConnectionPendingException If a connection operation is already in progress on this ShutdownChannelGroupException If the channel group has SecurityException If a security manager has been installed and it does not permit access to the given remote #getRemoteAddress This method performs exactly the same security checks as the } class. If the connection cannot be established then the channel is closed. ![]() The handler} parameter is a completion handler that is invoked whenthe connection is successfully established or connection cannot be established. This method initiates an operation to connect this channel. A socket connected to a multicast address may only be used to send address the remote address for the port the remote port for the IllegalArgumentException if the address is null,or the port is out of SecurityException if the caller is not allowed tosend datagrams to and receive datagrams from the address and #receive ![]() On a send operation, if the packet's address is set and the packet's address and the socket's address do not match, an IllegalArgumentException will be thrown. When a socket is connected, receive and send will not perform any security checks on incoming and outgoing packets, other than matching the packet's and the socket's address and port. Note, there is no guarantee that the exception will be thrown.Ī caller's permission to send and receive datagrams to a given host and port are checked at connect time. If the remote destination to which the socket is connected does not exist, or is otherwise unreachable, and if an ICMP destination unreachable packet has been received for that address, then a subsequent call to send or receive may throw a PortUnreachableException. By default a datagram socket is not connected. When a socket is connected to a remote address, packets may only be sent to or received from that address. Connects the socket to a remote address for this socket.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |