diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-02-27 06:41:03 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-02-27 06:41:03 +0000 |
commit | 8a51dd0db9176a56c482ca5cecb5051d2b6848ba (patch) | |
tree | 523e74a7dc8bc5538953b71dabf3ff9fd8a168b4 /src/connectionmanager.h | |
parent | c208b397b798910df4ad129fb13d562b4450034e (diff) | |
download | libbu++-8a51dd0db9176a56c482ca5cecb5051d2b6848ba.tar.gz libbu++-8a51dd0db9176a56c482ca5cecb5051d2b6848ba.tar.bz2 libbu++-8a51dd0db9176a56c482ca5cecb5051d2b6848ba.tar.xz libbu++-8a51dd0db9176a56c482ca5cecb5051d2b6848ba.zip |
This may require slightly more testing, but basically I made ConnectionManager
more general, you can now listen to all local addresses (the old way), or
individual addressses.
Diffstat (limited to 'src/connectionmanager.h')
-rw-r--r-- | src/connectionmanager.h | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/connectionmanager.h b/src/connectionmanager.h index e80119b..cff036b 100644 --- a/src/connectionmanager.h +++ b/src/connectionmanager.h | |||
@@ -37,15 +37,40 @@ public: | |||
37 | 37 | ||
38 | /** | 38 | /** |
39 | * Starts a server socket and binds to it, listening for new connections. | 39 | * Starts a server socket and binds to it, listening for new connections. |
40 | * Unlike the version of this that takes two parameters, this listens on | ||
41 | * all local addresses, or the virtual 0.0.0.0 address if available, which | ||
42 | * is mapped to all active local addresses. | ||
40 | *@param nPort The port to listen on. | 43 | *@param nPort The port to listen on. |
41 | *@param nInitPool The size of the initial connection pool. This will | ||
42 | * grow automatically if necesarry. | ||
43 | *@returns True if the socket was bound to the port and serving was | 44 | *@returns True if the socket was bound to the port and serving was |
44 | * started. False if there was a problem connecting to the port. | 45 | * started. False if there was a problem connecting to the port. |
45 | */ | 46 | */ |
46 | bool startServer( int nPort ); | 47 | bool startServer( int nPort ); |
47 | 48 | ||
48 | /** | 49 | /** |
50 | * Starts a server socket and binds to it, listening only on the address | ||
51 | * specified. If you want to listen to all local addresses you can enter | ||
52 | * "0.0.0.0" for the address, but the version of this with one parameter | ||
53 | * is more universal. | ||
54 | *@param sAddr The local ip address to bind to | ||
55 | *@param nPort The port to listen on. | ||
56 | *@returns True if the socket was bound to the port and serving was | ||
57 | * started. False if there was a problem connecting to the port. | ||
58 | */ | ||
59 | bool startServer( const char *sAddr, int nPort ); | ||
60 | |||
61 | /** | ||
62 | * I recomend probably not using this function on your own too much, it | ||
63 | * does the real work of setting up a socket, but requires a properly | ||
64 | * prepared sackaddr_in structure. This isn't too hard, but it's easier | ||
65 | * to use the other startServer functions. They call this function after | ||
66 | * some prepwork. | ||
67 | *@param name A properly formed sockaddr_in structure that will not be | ||
68 | * modified, but describes how to listen and to what to listen. | ||
69 | *@returns True on success. | ||
70 | */ | ||
71 | bool startServer( struct sockaddr_in &name ); | ||
72 | |||
73 | /** | ||
49 | * This is identicle to the simpler startServer function except that it | 74 | * This is identicle to the simpler startServer function except that it |
50 | * will automatically try to connect multiple times in case the first | 75 | * will automatically try to connect multiple times in case the first |
51 | * attempt or two doesn't work for some reason. Initially this was | 76 | * attempt or two doesn't work for some reason. Initially this was |