What is the difference between socket and tcpclient?

Source: Internet
Author: User
I post 1 :-----------------------------
Physical Layer: hub, network cable
Link Layer: Mac, ARP, switch
Network Layer: IP, ICMP, IGMP, Router
Transport Layer: TCP, UDP
Session Layer: HTTP, SMTP, FTP, POP3
Presentation Layer: soap, SSL
Application Layer: WebService Method
-------------------------------
Socket is a network-layer operation.
Tcpclient is an operation on the transport layer
ASP. NET is a Session Layer operation. You can use socket to access ASP. NET pages in IIS. However, at the transport layer, the Session Layer conversion will be self-used. Code Implemented:
You can use socket to access ASP. NET pages in IIS. However, at the transport layer, the Session Layer conversion is implemented by using code.
======================================
What does the above mean? I posted 2:
If you use socket to access IIS, consider the following: Network Layer:
What network layer protocol is used, such as IPv4 or IPv6? If the development router needs to consider this problem, the transmission layer:
You need to use the transport layer protocol, such as TCP. Session Layer:
You need to use the Session Layer Protocol, such as HTTP. ========================================================== ==================
In other words, you can use
The socket class. Send method sends the following binary string to IIS
//
GET /? T1 = 234 & t2 = 789 & b1 = % CC % E1 % BD % bb http/1.1
Accept: image/GIF, image/X-xbitmap, image/JPEG, image/pjpeg, application/vnd. MS-Excel, application/vnd. MS-PowerPoint, application/MSWord ,*/*
Accept-language: ZH-CN
Accept-encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0;. Net CLR 1.0.3705)
HOST: 192.168.0.2: 81
Connection: keep-alive
// You will receive the following data using receive:
//
HTTP/1.0 200 OK
Mime_version: 1.0
Content_type: text/html
Content_length: N [input type = button]
//
Then you can parse the data into an HTML page button
//////////////////////////////////////// /// // The above operations are as follows:
Network Layer ----- Session Layer, use socket to access ASP. NET pages in IIS
In the transport layer, the Session Layer conversion is implemented by code, but to do so, Web developers will die very badly. Therefore, as long as Web development can implement [Session Layer-Session Layer ],
All he has to do is [Form] to IIS and response to the client.
At the time of WebService method development, response does not have to worry about my post 3: Now let's talk about [What is the difference between socket and tcpclient] socket: Network Layer
Tcpclient: transport layer when you only consider: Host, port, data transmission, use tcpclient, or udpclient
When you want to consider: IP packets, routes, IP data packets, socket classes in socket and net provide some advanced encapsulation of socket operations, but at the same time cannot implement some socket bottom operations. Currently, socket is not recommended in net, just as we do not recommend using net to develop DirectX. Although it can be achieved when vrouters and vswitches use Win CE to integrate the net class, I may be out of date.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.