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 many 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.IPopens 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.TcporProtocolType.Udpunless you are doing some low-level networking stuff writing your own transport protocol.