A common means for (un)related objects to communicate with each other.
Questions tagged [protocols]
5211 questions
338
votes
18 answers
Get protocol, domain, and port from URL
I need to extract the full protocol, domain, and port from a given URL. For example:
https://localhost:8181/ContactUs-1.0/contact?lang=it&report_type=consumer
>>>
https://localhost:8181
![](../../users/profiles/499857.webp)
yelo3
- 4,893
- 5
- 22
- 23
220
votes
8 answers
How do I create my own URL protocol? (e.g. so://...)
I have seen:
http://www...
ftp://blah.blah...
file://blah.blah...
unreal://blah.blah...
mailto://blah.blah...
What is that first section where you see http and the like called?
Can I register my own?
![](../../users/profiles/37510.webp)
Michael Beck
- 2,598
- 3
- 18
- 21
175
votes
3 answers
Difference between Pragma and Cache-Control headers?
I read about Pragma header on Wikipedia which says:
"The Pragma: no-cache header field is an HTTP/1.0 header intended for
use in requests. It is a means for the browser to tell the server and
any intermediate caches that it wants a fresh…
![](../../users/profiles/682662.webp)
saplingPro
- 18,513
- 51
- 134
- 185
152
votes
13 answers
Difference between TCP and UDP?
What is the difference between TCP and UDP?
I know that TCP is used in the case of non-time critical applications, and UDP is used for games or applications that require fast transmission of data. I know that TCP is used for HTTP, HTTPs, FTP, SMTP,…
![](../../users/profiles/749414.webp)
user749414
- 1,537
- 2
- 10
- 4
138
votes
2 answers
Simple explanation of clojure protocols
I'm trying to understand clojure protocols and what problem they are supposed to solve. Does anyone have a clear explanation of the whats and whys of clojure protocols?
![](../../users/profiles/190822.webp)
yazz.com
- 52,748
- 62
- 227
- 363
105
votes
2 answers
Cast an instance of a class to a @protocol in Objective-C
I have an object (a UIViewController) which may or may not conform to a protocol I've defined.
I know I can determine if the object conforms to the protocol, then safely call the method:
if([self.myViewController…
![](../../users/profiles/74530.webp)
Ford
- 1,426
- 3
- 12
- 19
100
votes
8 answers
binary protocols v. text protocols
does anyone have a good definition for what a binary protocol is? and what is a text protocol actually? how do these compare to each other in terms of bits sent on the wire?
here's what wikipedia says about binary protocols:
A binary protocol is a…
![](../../users/profiles/317416.webp)
der_grosse
- 1,011
- 2
- 8
- 4
95
votes
4 answers
How to require that a protocol can only be adopted by a specific class
I want this protocol:
protocol AddsMoreCommands {
/* ... */
}
only to be adopted by classes that inherit from the class UIViewController. This page tells me I can specify that it is only adopted by a class (as opposed to a struct) by…
![](../../users/profiles/1134551.webp)
emrys57
- 6,349
- 2
- 37
- 44
93
votes
4 answers
How do I register a custom URL protocol in Windows?
How do I register a custom protocol with Windows so that when clicking a link in an email or on a web page my application is opened and the parameters from the URL are passed to it?
![](../../users/profiles/2189521.webp)
lukeck
- 3,974
- 2
- 25
- 29
92
votes
1 answer
Can a category implement a protocol in Objective C?
I have a category on NSDate and it would be convenient if it could implement a protocol I previously created. Is this possible? what's the correct syntax for this?
![](../../users/profiles/74415.webp)
cfischer
- 23,024
- 36
- 125
- 209
87
votes
11 answers
How can I send and receive WebSocket messages on the server side?
How can I send and receive messages on the server side using WebSocket, as per the protocol?
Why do I get seemingly random bytes at the server when I send data from the browser to the server? It the data encoded somehow?
How does the framing work…
![](../../users/profiles/514749.webp)
pimvdb
- 141,012
- 68
- 291
- 345
84
votes
9 answers
Protocol func returning Self
I have a protocol P that returns a copy of the object:
protocol P {
func copy() -> Self
}
and a class C that implements P:
class C : P {
func copy() -> Self {
return C()
}
}
However, whether I put the return value as Self I get…
![](../../users/profiles/1564088.webp)
aeubanks
- 1,201
- 1
- 11
- 12
83
votes
3 answers
What is the difference between DTR/DSR and RTS/CTS flow control?
What's the difference between DTR/DSR and RTS/CTS hardware flow control? When is each one used? Why do we need more than one kind of hardware flow control? :)
![](../../users/profiles/14731.webp)
Gili
- 76,473
- 85
- 341
- 624
83
votes
13 answers
How to detect browser's protocol handlers?
I have created a custom URL protocol handler.
http://
mailto://
custom://
I have registered a WinForms application to respond accordingly. This all works great.
But I would like to be able to gracefully handle the case where the user doesn't have…
![](../../users/profiles/23294.webp)
Chris Craft
- 5,155
- 6
- 42
- 63
83
votes
4 answers
Why I can't use let in protocol in Swift?
I have a doubt about protocols in Swift about the use of var and the keywords { get set }.
From Apple documentation:
If a protocol requires a property to be gettable and settable, that
property requirement cannot be fulfilled by a constant stored…
![](../../users/profiles/4582941.webp)
Massimo Polimeni
- 4,546
- 3
- 21
- 50