SendServerController.h
上传用户:shqiling
上传日期:2009-10-04
资源大小:154k
文件大小:4k
源码类别:

MacOS编程

开发平台:

Objective-C

  1. /*
  2.     File:       SendServerController.h
  3.     Contains:   Manages the send server tab.
  4.     Written by: DTS
  5.     Copyright:  Copyright (c) 2009 Apple Inc. All Rights Reserved.
  6.     Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
  7.                 ("Apple") in consideration of your agreement to the following
  8.                 terms, and your use, installation, modification or
  9.                 redistribution of this Apple software constitutes acceptance of
  10.                 these terms.  If you do not agree with these terms, please do
  11.                 not use, install, modify or redistribute this Apple software.
  12.                 In consideration of your agreement to abide by the following
  13.                 terms, and subject to these terms, Apple grants you a personal,
  14.                 non-exclusive license, under Apple's copyrights in this
  15.                 original Apple software (the "Apple Software"), to use,
  16.                 reproduce, modify and redistribute the Apple Software, with or
  17.                 without modifications, in source and/or binary forms; provided
  18.                 that if you redistribute the Apple Software in its entirety and
  19.                 without modifications, you must retain this notice and the
  20.                 following text and disclaimers in all such redistributions of
  21.                 the Apple Software. Neither the name, trademarks, service marks
  22.                 or logos of Apple Inc. may be used to endorse or promote
  23.                 products derived from the Apple Software without specific prior
  24.                 written permission from Apple.  Except as expressly stated in
  25.                 this notice, no other rights or licenses, express or implied,
  26.                 are granted by Apple herein, including but not limited to any
  27.                 patent rights that may be infringed by your derivative works or
  28.                 by other works in which the Apple Software may be incorporated.
  29.                 The Apple Software is provided by Apple on an "AS IS" basis. 
  30.                 APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  31.                 WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
  32.                 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING
  33.                 THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
  34.                 COMBINATION WITH YOUR PRODUCTS.
  35.                 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT,
  36.                 INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
  37.                 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  38.                 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY
  39.                 OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
  40.                 OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY
  41.                 OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
  42.                 OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF
  43.                 SUCH DAMAGE.
  44. */
  45. #import <UIKit/UIKit.h>
  46. enum {
  47.     kSendBufferSize = 32768
  48. };
  49. @interface SendServerController : UIViewController
  50. {
  51.     UILabel *                   _statusLabel;
  52.     UIActivityIndicatorView *   _activityIndicator;
  53.     UIButton *                  _startOrStopButton;
  54.     
  55.     NSNetService *              _netService;
  56.     CFSocketRef                 _listeningSocket;
  57.     
  58.     NSUInteger                  _currentImageNumber;
  59.     
  60.     NSOutputStream *            _networkStream;
  61.     NSInputStream *             _fileStream;
  62.     uint8_t                     _buffer[kSendBufferSize];
  63.     size_t                      _bufferOffset;
  64.     size_t                      _bufferLimit;
  65. }
  66. @property (nonatomic, retain) IBOutlet UILabel *                   statusLabel;
  67. @property (nonatomic, retain) IBOutlet UIActivityIndicatorView *   activityIndicator;
  68. @property (nonatomic, retain) IBOutlet UIButton *                  startOrStopButton;
  69. - (IBAction)startOrStopAction:(id)sender;
  70. @end