tailieunhanh - C# .NET Web Developer's Guide phần 4

Thời gian chạy có một mô hình xử lý ngoại lệ sử dụng các khối bảo vệ của mã để kiểm soát dòng chảy thực hiện. Cấu trúc cơ bản của các khối mã cho các cú pháp C # trongKẾT QUẢ: Các góc trên bên trái của biểu mẫu được đặt tại 15 pixels từ bên trái và 15 điểm ảnh từ phía trên cùng của màn hình, tương ứng. | 224 Chapter 5 Network Programming Using TCP and UDP Protocols Execute is more complex. If the command processor is in the Release Connection mode it first must connect to the server and finally close the connection after sending the command see Figure . For sending the command is concatenated with a trailing carriage return and line feed. After that it is converted to a byte array. This array is given to the output stream. Then the processor reads the response from the input stream. Finally it checks if the response in the string is BYE . If so false is returned true otherwise. Figure ExecuteO Method of TCPRemoteCommandProcessor in public bool Execute string command ref string result add parameter checking here bool ret true if connecting to . open connection to the server new TcpClient new StreamReader connected to add a CRLF to command to indicate end command r n convert command string to byte array Byte cmd Continued Network Programming Using TCP and UDP Protocols Chapter 5 225 Figure Continued send request cmd 0 get response result if close connection connection closed host port ret BYE return ret Finally you need a client using the command processor. Call it source code for Figure is included on the CD in the file . It creates a TCPCommandProcessor instance for communicating with the server. Then it sends the GET command and displays the result on the console. After that it sends the EXIT command and closes the connection. Figure TCPHelloWorldClient Listing in using .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã 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.