Friday, June 10, 2016

Pemrograman Jaringan Rabu 8 Juni 2016 jam 9-11 WIB

Halo teman", sorry telat posting. Btw, ini dia tugas kalian. Tugasnya simple, analisa dan perbaiki coding yang sudah ad. Acuan ny buku Richard Bloom yang bisa kalian dapatkan d google hueheehehee :D

Subjek    : NIM_ProgjarRabu_tugas3
Kirim      : 672012109@student.uksw.edu
Deadline : Sebelum kelas 8 Pagi (Rabu, 15 Juni 2016 08.00 WIB)

Tugasnya di buat dalam bentuk PDF/Word 2010/13/16.

Coding 3.1

using System;
using Microsoft.Win32;
class FindDNServers
{
public static void Main()
{
RegistryKey start = Registry.
LocalMachine;
String DNSservers = @"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters";
RegistryKey DNSserverKey = start.
OpenSubKey(DNSservers);
if (DNSserverKey == null)
{
Console.WriteLine("Unable to open DNS servers key");
return;
}

string serverlist = (string)DNSserverKey.GetValue ("NameServer");
Console.WriteLine("DNS Servers: {0}", serverlist);
DNSserverKey.Close();
start.Close();
char[] token = new char[1];
token[0] = ' ';
string[] servers = serverlist Split(token);
foreach(string server in servers)
{
Console.WriteLine("DNS server: {0}", server);
}
}

}

Coding 3.2

using System;
using System.Net;
using System.Net.Socket;

class SockProp
{
public static void Main ()
{
IPAddress ia = IPAddress.Parse("192.168.88.10");
Socket test = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
Console.WriteLine("AddressFamily: {0}",test.AddressFamily);
Console.WriteLine("SocketType: {0}",test.SocketType);
Console.WriteLine("ProtocolType: {0}",test.ProtocolType);
Console.WriteLine("Blocking: {0}", test.Blocking);
test.Blocking = false;
Console.WriteLine("new Blocking: {0}", test.Blocking);
Console.WriteLine("Connected: {0}", test.Connected);
test.Bind(ie);
IPEndPoint iep = (IPEndPoint)test.LocalEndPoint;
Console.WriteLine("Local EndPoint: {0}",iep.ToString());
test.Close();;


}

No comments:

Post a Comment