PEMROGRAMAN SOCKET
1. TUGAS KEREN
import java.net.InetAddress;
public class tugaskeren {
public static void main(String[]args){
try {
InetAddress address = InetAddress.getByName(“127.0.0.1″);
boolean reachable = address.isReachable(10000);
System.out.println(“Is Reachable?” + reachable);
} catch (Exception e){
e.printStackTrace();
}
}
}
2. TUGAS HEBAT
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
public class TugasHebat {
public static void main (String [] args) throws Exception {
String host = “localhost”;
InetAddress inetAddress = InetAddress.getByName (host);
String hostName = inetAddress.getHostName();
for (int port = 0;port <= 65535;port++){
try {
Socket socket = new Socket (hostName, port);{
}
String text = hostName + “is listening on port” + port;
System.out.println (text);
socket.close();
}catch (IOException e){
String s = hostName + “is listening on port” + port;
System.out.println(s);
}
}
}
}
3. TUGAS OK
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
public class TugasOK {
public static void main(String[]args) throws UnknownHostException, SocketException{
try{
InetAddress address = InetAddress.getByName(“192.168.1.55″);
NetworkInterface ni = NetworkInterface.getByInetAddress(address);
if(ni != null){
byte[] mac = ni.getHardwareAddress();
if(mac != null){
for(int i=0; i<mac.length; i++){
System.out.format(“%02x%”,mac[i],
(i < mac.length-1)?”-”:”");
}
}
else{
System.out.println(“addres is not accesible”);
}
}
else{
System.out.println(“network interface not found”);
}
}catch(UnknownHostException e){
e.printStackTrace();
}catch(SocketException e){
e.printStackTrace();
}
}
}
silahkan donwload contoh programnya
di sini

Pertandingan paling dramatis adalah TOFATEK VS PORGAFTA, di ajang Tofatek super Competition 2009 tuan rumah Tofatek bertemu dengan musuh bebuyutannya yakni Porgafta. Memang kerap kali Tofatek bertemu Porgafta pasti pertandingan terjadi insident yakni tindakan anarkis antar suporter bahkan antar pemain ikut bersitegang. Tofatek dan Porgafta bisa di bilang menjadi sebuah derby dengan Aura atmosfer yang sangat panas dimana dalam kancah lokal tidak ada yang mau mengalah.


Komentar