C#OSI5.1 5.1 OSI 5.1.1 OSITCP/IP 2Data Link Layer 3Network Layer 5Session Layer 6Presentation Layer OSI TCP/IPAdvanced Research Projects Agency NetworkARPANETARPANETU.SDepartment of DefenseDoDARPANET— 5.1.1 OSITCP/IP 5.1.1 OSITCP/IP 2 TCP/IPIPICMPIGMP 5.1.1 OSITCP/IP 4 HTTPSNMPFTPSMTPDNSTelnetTCPFTPHTTPUDPSNMP 5.1.1 OSITCP/IP 5.1.1 OSITCP/IP 2TCPTCPIP 3TCPIPIPIPIP 4MACIPMACMACMACMACR 5AIPB 5.1.1 OSITCP/IP 8TCPTCP 9TCP 5.1.1 OSITCP/IP IP TCP/IPIPIPTCP/IPIPv4IP320232-1328192.168.0.181IPIP = + IPv4IPv6IP128 IPABCDEABCDE“*” 5 C# 5 C# E4“1111”240.0.0.0255.255.255.255 5 C# ABC“1”175.22.255.255175.22.0.0 IP“127”127.0.0.1“ping”IP 5 C# 32“1”“0”IPIP 2 5 C# 3 5 C# 1 5 C# 2 4 3 1Table-Lookup↔ 5 C# TCP/IPAddress Resolution ProtocolARPARPIPIPARPIP ARPIPARPARPIP 5 C# 5 C# 3 4 5 5 C# 5 C# System.Net.Cache System.Web.UI System.Web.Mobile 5 C# IPEndPointIPIPIPEndPoint { Console.WriteLine([{0}]{1},i,addr[i].AddressFamily.ToString()); } Windows SocketsUNIXSocketMicrosoft WindowsWindows SocketsAPIWindows Sockets 1.1Berkeley SocketsTCP/IPWindows Sockets 2Windows Sockets 1.1 5 C# TCP/IPWindows SocketsAF-INET 1SOCK_STREAM FTP 2SOCK_DGRAM 3SOCK_RAW / OSI“” 5 C# 3 4 1 SocketSynchronousAsynchronousBlockUnblock 1 3 APIselect 3 5 C# 1 TCP/IPIP5.75.8 5 C# 2Listen(int con_num) SocketFlagsSocket SocketFlags 5 C# Console.WriteLine(AddressFamily: {0},test_socket.AddressFamily); Console.WriteLine(SocketType: {0},test_socket.SocketType); Console.WriteLine(ProtocolType: {0},test_socket.ProtocolType); Console.WriteLine(Blocking: {0},test_socket.Blocking); 2DLL Windows 5 C# 1 5 C# 4 ThreadState t1.Start();// } } } Thread.Sleep(1000);//1000 4 if (t1.ThreadState == ThreadState.Running)// if (t1.IsAlive)// 5 C# 1Lock lockexpressionstatement_block locktypeof{ } 5 C# TryEnter() Exit() createdNewtruefalse WaitOnefalseexitContexttruefalse public void ReleaseMutex() C#5 EatAppleSmpProductorConsumerDishDishlock5.35.10 5 C# Dish dish = new Dish(this, 30); Productor mother = new Productor(, dish);// Productor father = new Productor(, dish); Consumer old = new Consumer(, dish, 1000); Consumer middle = new Consumer(, dish, 1200); Consumer young = new Consumer(, dish, 1500); th_mother = new Thread(new ThreadStart(mother.run)); th_father = new Thread(new ThreadStart(father.run)); th_old = new Thread(new ThreadStart(old.run)); th_middle = new Thread(new ThreadStart(middle.run)); th_young = new Thread(new ThreadStart(young.run)); { this.oEAP = oEAP; this.EnabledNum = EnabledNum; { { this.name = name; this.dish = dish; this.timelong = timelong;