![]() |
IOS Streaming Browser 1.0
An IOS streaming browser to stream the display to others or to a projector
|
#import <GCDAsyncSocket.h>
Public Member Functions | |
(dispatch_queue_t) | - newSocketQueueForConnectionFromAddress:onSocket: |
(void) | - socket:didAcceptNewSocket: |
(void) | - socket:didConnectToHost:port: |
(void) | - socket:didReadData:withTag: |
(void) | - socket:didReadPartialDataOfLength:tag: |
(void) | - socket:didWriteDataWithTag: |
(void) | - socket:didWritePartialDataOfLength:tag: |
(NSTimeInterval) | - socket:shouldTimeoutReadWithTag:elapsed:bytesDone: |
(NSTimeInterval) | - socket:shouldTimeoutWriteWithTag:elapsed:bytesDone: |
(void) | - socketDidCloseReadStream: |
(void) | - socketDidDisconnect:withError: |
(void) | - socketDidSecure: |
Definition at line 1134 of file GCDAsyncSocket.h.
- (dispatch_queue_t) newSocketQueueForConnectionFromAddress: | (NSData *) | address | |
onSocket: | (GCDAsyncSocket *) | sock | |
[optional] |
This method is called immediately prior to socket:didAcceptNewSocket:. It optionally allows a listening socket to specify the socketQueue for a new accepted socket. If this method is not implemented, or returns NULL, the new accepted socket will create its own default queue.
Since you cannot autorelease a dispatch_queue, this method uses the "new" prefix in its name to specify that the returned queue has been retained.
Thus you could do something like this in the implementation: return dispatch_queue_create("MyQueue", NULL);
If you are placing multiple sockets on the same queue, then care should be taken to increment the retain count each time this method is invoked.
For example, your implementation might look something like this: dispatch_retain(myExistingQueue); return myExistingQueue;
- (void) socket: | (GCDAsyncSocket *) | sock | |
didAcceptNewSocket: | (GCDAsyncSocket *) | newSocket | |
[optional] |
Called when a socket accepts a connection. Another socket is automatically spawned to handle it.
You must retain the newSocket if you wish to handle the connection. Otherwise the newSocket instance will be released and the spawned connection will be closed.
By default the new socket will have the same delegate and delegateQueue. You may, of course, change this at any time.
- (void) socket: | (GCDAsyncSocket *) | sock | |
didConnectToHost: | (NSString *) | host | |
port: | (UInt16) | port | |
[optional] |
Called when a socket connects and is ready for reading and writing. The host parameter will be an IP address, not a DNS name.
- (void) socket: | (GCDAsyncSocket *) | sock | |
didReadData: | (NSData *) | data | |
withTag: | (long) | tag | |
[optional] |
Called when a socket has completed reading the requested data into memory. Not called if there is an error. param NCDAsyncSocket param NSData param long
- (void) socket: | (GCDAsyncSocket *) | sock | |
didReadPartialDataOfLength: | (NSUInteger) | partialLength | |
tag: | (long) | tag | |
[optional] |
Called when a socket has read in data, but has not yet completed the read. This would occur if using readToData: or readToLength: methods. It may be used to for things such as updating progress bars.
- (void) socket: | (GCDAsyncSocket *) | sock | |
didWriteDataWithTag: | (long) | tag | |
[optional] |
Called when a socket has completed writing the requested data. Not called if there is an error.
- (void) socket: | (GCDAsyncSocket *) | sock | |
didWritePartialDataOfLength: | (NSUInteger) | partialLength | |
tag: | (long) | tag | |
[optional] |
Called when a socket has written some data, but has not yet completed the entire write. It may be used to for things such as updating progress bars.
- (NSTimeInterval) socket: | (GCDAsyncSocket *) | sock | |
shouldTimeoutReadWithTag: | (long) | tag | |
elapsed: | (NSTimeInterval) | elapsed | |
bytesDone: | (NSUInteger) | length | |
[optional] |
Called if a read operation has reached its timeout without completing. This method allows you to optionally extend the timeout. If you return a positive time interval (> 0) the read's timeout will be extended by the given amount. If you don't implement this method, or return a non-positive time interval (<= 0) the read will timeout as usual.
The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method. The length parameter is the number of bytes that have been read so far for the read operation.
Note that this method may be called multiple times for a single read if you return positive numbers.
- (NSTimeInterval) socket: | (GCDAsyncSocket *) | sock | |
shouldTimeoutWriteWithTag: | (long) | tag | |
elapsed: | (NSTimeInterval) | elapsed | |
bytesDone: | (NSUInteger) | length | |
[optional] |
Called if a write operation has reached its timeout without completing.
This method allows you to optionally extend the timeout.
If you return a positive time interval (> 0) the write's timeout will be extended by the given amount.
If you don't implement this method, or return a non-positive time interval (<= 0) the write will timeout as usual.
The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method.
The length parameter is the number of bytes that have been written so far for the write operation.
Note that this method may be called multiple times for a single write if you return positive numbers.
param GCDAsyncSocket param long param NSTimeInterval param NSUInteger returns NSTimeInterval
- (void) socketDidCloseReadStream: | (GCDAsyncSocket *) | sock | [optional] |
Conditionally called if the read stream closes, but the write stream may still be writeable.
This delegate method is only called if autoDisconnectOnClosedReadStream has been set to NO. See the discussion on the autoDisconnectOnClosedReadStream method for more information. param GCDAsyncSocket
- (void) socketDidDisconnect: | (GCDAsyncSocket *) | sock | |
withError: | (NSError *) | err | |
[optional] |
Called when a socket disconnects with or without error.
If you call the disconnect method, and the socket wasn't already disconnected, this delegate method will be called before the disconnect method returns. param GCDAsyncSocket param NSError
- (void) socketDidSecure: | (GCDAsyncSocket *) | sock | [optional] |
Called after the socket has successfully completed SSL/TLS negotiation.
This method is not called unless you use the provided startTLS method.
If a SSL/TLS negotiation fails (invalid certificate, etc) then the socket will immediately close, and the socketDidDisconnect:withError: delegate method will be called with the specific SSL error code. param GCDAsyncSocket