开发者

What's the difference between using ProtocolType.IP and ProtocolType.Tcp

I've just answered problem with sockets in c# where in my example code I initializing my socket using ProtocolType.IP as this is what I've always used in my own code, and it has never caused me problems. But I see m开发者_运维知识库any examples specifying ProtocolType.Tcp.

I guess, what I'm asking is, by using ProtocolType.IP instead of ProtocolType.Tcp is anything being performed differently under the hood that I should be aware of?


I would guess that ProtocolType.IP opens a "raw IP" socket, in other words it just squirts raw bytes onto the network as IP packets rather than going through the TCP or UDP protocol layers.

In contrast to TCP, you won't get guaranteed delivery of packets, packets may arrive out of order and/or packets may be duplicated. TCP handles all this as part of its protocol.

For almost all purposes I would expect you should be using ProtocolType.Tcp or ProtocolType.Udp unless you are doing some low-level networking stuff writing your own transport protocol.


check this link: http://www.allinterview.com/showanswers/1447.html

TCP/IP is a protocol suite, means it is the combination of protocols which are related to TCP and IP. TCP is a transport layer protocol whereas IP is a network layer protocol. TCP is a connection oriented protocol and IP is a connection less protocol

Hope it helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜