Mercurial > pidgin.yaz
comparison src/network.h @ 8248:fabcfd9a7c1c
[gaim-migrate @ 8971]
marv, is this peachy?
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 12 Feb 2004 23:41:04 +0000 |
parents | e7524f4b4ed2 |
children | b248c1f4efbd |
comparison
equal
deleted
inserted
replaced
8247:4a6448907382 | 8248:fabcfd9a7c1c |
---|---|
87 */ | 87 */ |
88 const char *gaim_network_get_ip_for_account(const GaimAccount *account, int fd); | 88 const char *gaim_network_get_ip_for_account(const GaimAccount *account, int fd); |
89 | 89 |
90 /** | 90 /** |
91 * Attempts to open a listening port ONLY on the specified port number. | 91 * Attempts to open a listening port ONLY on the specified port number. |
92 * Can be used if MUST be listening on a certain port. You probably | 92 * You probably want to use gaim_network_listen_range() instead of this. |
93 * want to use gaim_network_listen_range() instead of this. | 93 * This function is useful, for example, if you wanted to write a telnet |
94 * server as a Gaim plugin, and you had to listen on port 23. Why anyone | |
95 * would want to do that is beyond me. | |
94 * | 96 * |
95 * This opens a listening port. The caller will want to set up a watcher | 97 * This opens a listening port. The caller will want to set up a watcher |
96 * of type GAIM_INPUT_READ on the returned fd. It will probably call | 98 * of type GAIM_INPUT_READ on the returned fd. It will probably call |
97 * accept in the callback, and then possibly remove the watcher and close | 99 * accept in the callback, and then possibly remove the watcher and close |
98 * the listening socket, and add a new watcher on the new socket accept | 100 * the listening socket, and add a new watcher on the new socket accept |
104 * no socket could be established. | 106 * no socket could be established. |
105 */ | 107 */ |
106 int gaim_network_listen(short port); | 108 int gaim_network_listen(short port); |
107 | 109 |
108 /** | 110 /** |
109 * Opens a listening port selected from a range of ports. | 111 * Opens a listening port selected from a range of ports. The range of |
112 * ports used is chosen in the following manner: | |
113 * If a range is specified in preferences, these values are used. | |
114 * If a non-0 values are passed to the function as parameters, these | |
115 * values are used. | |
116 * Otherwise a port is chosen at random by the kernel. | |
110 * | 117 * |
111 * This opens a listening port. The caller will want to set up a watcher | 118 * This opens a listening port. The caller will want to set up a watcher |
112 * of type GAIM_INPUT_READ on the returned fd. It will probably call | 119 * of type GAIM_INPUT_READ on the returned fd. It will probably call |
113 * accept in the callback, and then possibly remove the watcher and close | 120 * accept in the callback, and then possibly remove the watcher and close |
114 * the listening socket, and add a new watcher on the new socket accept | 121 * the listening socket, and add a new watcher on the new socket accept |
115 * returned. | 122 * returned. |
116 * | 123 * |
117 * @note This function always lets the core override its args with the | 124 * @param start The port number to bind to, or 0 to pick a random port. |
118 * value of the user preferences. | |
119 * | |
120 * @param start The port number to bind to, or 0 to let the core decide. | |
121 * By default, the core will let the kernel pick one at random. | |
122 * Users are allowed to override this arg in prefs. | 125 * Users are allowed to override this arg in prefs. |
123 * @param end The highest possible port in the range of ports to listen on, | 126 * @param end The highest possible port in the range of ports to listen on, |
124 * or 0 to let the core decide Users are allowed to override this | 127 * or 0 to pick a random port. Users are allowed to override this |
125 * arg in prefs. | 128 * arg in prefs. |
126 * @return The file descriptor of the listening socket, or -1 if | 129 * @return The file descriptor of the listening socket, or -1 if |
127 * no socket could be established. | 130 * no socket could be established. |
128 */ | 131 */ |
129 int gaim_network_listen_range(short start, short end); | 132 int gaim_network_listen_range(short start, short end); |