ObjFW
src/OFTCPSocket.h
00001 /*
00002  * Copyright (c) 2008, 2009, 2010, 2011
00003  *   Jonathan Schleifer <js@webkeks.org>
00004  *
00005  * All rights reserved.
00006  *
00007  * This file is part of ObjFW. It may be distributed under the terms of the
00008  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
00009  * the packaging of this file.
00010  *
00011  * Alternatively, it may be distributed under the terms of the GNU General
00012  * Public License, either version 2 or 3, which can be found in the file
00013  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
00014  * file.
00015  */
00016 
00017 #ifndef _WIN32
00018 # include <sys/types.h>
00019 # include <sys/socket.h>
00020 # include <netdb.h>
00021 #endif
00022 
00023 #import "OFStreamSocket.h"
00024 
00025 #ifdef _WIN32
00026 # include <ws2tcpip.h>
00027 #endif
00028 
00029 @class OFString;
00030 
00037 @interface OFTCPSocket: OFStreamSocket
00038 {
00039         BOOL                    isListening;
00040         struct sockaddr_storage *sockAddr;
00041         socklen_t               sockAddrLen;
00042 }
00043 
00050 - (void)connectToHost: (OFString*)host
00051                onPort: (uint16_t)port;
00052 
00062 - (uint16_t)bindToPort: (uint16_t)port
00063                 onHost: (OFString*)host;
00064 
00070 - (void)listenWithBackLog: (int)backlog;
00071 
00075 - (void)listen;
00076 
00081 - (OFTCPSocket*)accept;
00082 
00086 - (void)setKeepAlivesEnabled: (BOOL)enable;
00087 
00093 - (OFString*)remoteAddress;
00094 
00098 - (BOOL)isListening;
00099 @end
 All Classes Functions Variables