More factory changes to help with DLL
[pwlib.git] / include / ptlib / spxsock.h
blob5aac01e61726bed9474f3b9dcfa3c2dd30499277
1 /*
2 * spxsock.h
4 * SPX socket channel class
6 * Portable Windows Library
8 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
18 * under the License.
20 * The Original Code is Portable Windows Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25 * All Rights Reserved.
27 * Contributor(s): ______________________________________.
29 * $Log$
30 * Revision 1.9 2003/09/17 05:41:59 csoutheren
31 * Removed recursive includes
33 * Revision 1.8 2003/09/17 01:18:02 csoutheren
34 * Removed recursive include file system and removed all references
35 * to deprecated coooperative threading support
37 * Revision 1.7 2002/09/16 01:08:59 robertj
38 * Added #define so can select if #pragma interface/implementation is used on
39 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
41 * Revision 1.6 2001/05/22 12:49:32 robertj
42 * Did some seriously wierd rewrite of platform headers to eliminate the
43 * stupid GNU compiler warning about braces not matching.
45 * Revision 1.5 1999/03/09 02:59:51 robertj
46 * Changed comments to doc++ compatible documentation.
48 * Revision 1.4 1999/02/16 08:11:17 robertj
49 * MSVC 6.0 compatibility changes.
51 * Revision 1.3 1998/11/30 02:51:59 robertj
52 * New directory structure
54 * Revision 1.2 1998/09/23 06:21:29 robertj
55 * Added open source copyright license.
57 * Revision 1.1 1996/09/14 13:00:56 robertj
58 * Initial revision
62 #ifndef _PSPXSOCKET
63 #define _PSPXSOCKET
65 #ifdef P_USE_PRAGMA
66 #pragma interface
67 #endif
69 #include <ptlib/ipxsock.h>
72 /** Create a socket channel that uses the SPX transport over the IPX
73 Protocol.
75 class PSPXSocket : public PIPXSocket
77 PCLASSINFO(PSPXSocket, PIPXSocket);
79 public:
80 /**@name Construction. */
81 //@{
82 /** Create an SPX protocol socket channel. If a remote machine address or
83 a "listening" socket is specified then the channel is also opened.
85 Note that the "copy" constructor here is really a "listening" socket
86 the same as the PSocket & parameter version.
88 PSPXSocket(
89 WORD port = 0 /// Port number to use for the connection.
91 //@}
93 /**@name Overrides from class PSocket. */
94 //@{
95 /** Listen on a socket for a remote host on the specified port number. This
96 may be used for server based applications. A "connecting" socket begins
97 a connection by initiating a connection to this socket. An active socket
98 of this type is then used to generate other "accepting" sockets which
99 establish a two way communications channel with the "connecting" socket.
101 If the #port# parameter is zero then the port number as
102 defined by the object instance construction or the
103 #PIPSocket::SetPort()# function.
105 @return
106 TRUE if the channel was successfully opened.
108 virtual BOOL Listen(
109 unsigned queueSize = 5, /// Number of pending accepts that may be queued.
110 WORD port = 0, /// Port number to use for the connection.
111 Reusability reuse = AddressIsExclusive /// Can/Cant listen more than once.
114 /** Open a socket to a remote host on the specified port number. This is an
115 "accepting" socket. When a "listening" socket has a pending connection
116 to make, this will accept a connection made by the "connecting" socket
117 created to establish a link.
119 The port that the socket uses is the one used in the #Listen()#
120 command of the #socket# parameter.
122 Note that this function will block until a remote system connects to the
123 port number specified in the "listening" socket.
125 @return
126 TRUE if the channel was successfully opened.
128 virtual BOOL Accept(
129 PSocket & socket /// Listening socket making the connection.
131 //@}
133 protected:
134 virtual BOOL OpenSocket();
135 virtual const char * GetProtocolName() const;
138 // Include platform dependent part of class
139 #ifdef _WIN32
140 #include "msos/ptlib/spxsock.h"
141 #else
142 #include "unix/ptlib/spxsock.h"
143 #endif
146 #endif
148 // End Of File ///////////////////////////////////////////////////////////////