Created
March 31, 2011 20:19
-
-
Save enebo/897171 to your computer and use it in GitHub Desktop.
A.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.InetSocketAddress; | |
import java.nio.channels.DatagramChannel; | |
public class A { | |
public static void main(String[] args) { | |
try { | |
InetSocketAddress addr = new InetSocketAddress(4321); | |
DatagramChannel channel = DatagramChannel.open(); | |
System.out.println("Connected: " + channel.isConnected()); | |
System.out.println("Bound: " + channel.socket().isBound()); | |
System.out.println("Connected: " + channel.socket().isConnected()); | |
System.out.println("Closed: " + channel.socket().isClosed()); | |
System.out.println("Localport: " + channel.socket().getLocalPort()); | |
System.out.println("Connected: " + channel.isConnected()); | |
channel.socket().bind(addr); | |
} catch (Exception e) { | |
System.out.println("E: " + e); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment