Đang chuẩn bị liên kết để tải về tài liệu:
TCP/IP Sockets in C# Practical Guide for Programmers phần 6

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

MyThreadClass: đường 29/03 để thông qua nhà nước với phương pháp chúng tôi sẽ được chạy như chủ đề của riêng mình, chúng tôi đặt các phương pháp trong lớp học riêng của mình, và vượt qua các biến nhà nước trong xây dựng lớp. Trong trường hợp này, nhà nước là lời chào chuỗi được in. | 3.5 Wrapping Up 83 RecvUdp.cs 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 using System For Int32 ArgumentException using System.Net For IPEndPoint using System.Net.Sockets For UdpClient class RecvUdp static void Main string args if args.Length 1 args.Length 2 Test for correct of args throw new ArgumentException Parameter s Port encoding int port Int32.Parse args 0 Receiving Port UdpClient client new UdpClient port UDP socket for receiving byte packet new byte ItemQuoteTextConst.MAX_WIRE_LENGTH IPEndPoint remoteIPEndPoint new IPEndPoint IPAddress.Any port packet client.Receive ref remoteIPEndPoint ItemQuoteDecoderText decoder args.Length 2 Which encoding new ItemQuoteDecoderText args 1 new ItemQuoteDecoderText ItemQuote quote decoder.decode packet Console.WriteLine quote client.Close RecvUdp.cs 3.5 Wrapping Up We have seen how C data types can be encoded in different ways and how messages can be constructed from various types of information. You may be aware that the .NET framework includes serialization capabilities The System.Xml.Serializable and 84 Chapter 3 Sending and Receiving Messages System.Runtime.Serialization.Formatters name spaces contain classes that support writing a C class instance to an XML eXtensible Markup Language file binary format or SOAP Simple Object Access Protocol message suitable for sending over a network connection. Once at the remote host the file can be deserialized into a instance of that object. Similarly the System.Runtime.Remoting name space allows the ability to create a remote proxy object that a client can use to invoke methods on a server s object. It might seem that having these interfaces available would eliminate the need for what we have described in this chapter and that is true to some extent. However it is not always the case for several reasons. First the encoded forms produced by Serializable may not be very efficient. They may include information that is meaningless outside the .

TÀI LIỆU LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.